Formulas are derived giving the vector potential and the magnetic field components of a general coil of rectangular cross section and constant winding density. The solution is given in a cylindrical coordinate system in terms of trigonometric integrals. The formulas presented have been cross-checked and validated against alternative expressions giving the various field components as integrals of expressions containing Bessel and Struve functions. The trigonometric integrals for the fields can be evaluated easily to several hundred significant figures using mathematical packages such as Maple or Mathematica. Alternatively, they can be evaluated with a small FORTRAN program. Sample results and field line plots obtained with the method are given, and the field of a coil of rectangular cross section is examined in some detail. A comparison with the results of a finite-element method is also given.