We derive a general nonparaxial analytical representation of the eikonal function for the design of diffractive optical elements (DOE) producing a line focus. The eikonal is given in special curvilinear coordinates. The eikonal’s calculation, from the condition of focusing into a line with prescribed intensity distribution, is reduced to the solution of a first-order explicit differential equation. We design DOEs and nondiffractive refractive optical elements to generate a line-segment focus and a circular-arc focus. The simulation data demonstrates that the designed optical elements produce high-quality lines.