The large quantity and high quality of modern radio and infrared line observations require efficient modeling techniques to infer physical and chemical parameters such as temperature, density, and molecular abundances. Radex calculates the intensities of atomic and molecular lines produced in a uniform medium, based on statistical equilibrium calculations involving collisional and radiative processes and including radiation from background sources. Optical depth effects are treated with an escape probability method. The program makes use of molecular data files maintained in the Leiden Atomic and Molecular Database (LAMDA), which will continue to be improved and expanded. The performance of the program is compared with more approximate and with more sophisticated methods. An Appendix provides diagnostic plots to estimate physical parameters from line intensity ratios of commonly observed molecules. This program should form an important tool in analyzing observations from current and future radio and infrared telescopes.