We present calculations of the electronic structure of various atoms and molecules in strong magnetic fields ranging from B = 10 12 G to 2×10 15 G, appropriate for radio pulsars and magnetars. For these field strengths, the magnetic forces on the electrons dominate over the Coulomb forces, and to a good approximation the electrons are confined to the ground Landau level. Our calculations are based on the density functional theory, and use a local magnetic exchange-correlation function which is tested to be reliable in the strong field regime. Numerical results of the ground-state energies are given for HN (up to N = 10), HeN (up to N = 8), CN (up to N = 5), and FeN (up to N = 3), as well as for various ionized atoms. Fitting formulae for the B-dependence of the energies are also given. In general, as N increases, the binding energy per atom in a molecule, |EN |/N , increases and approaches a constant value. For all the field strengths considered in this paper, hydrogen, helium, and carbon molecules are found to be bound relative to individual atoms (although for B less than a few ×10 12 G, carbon molecules are very weakly bound relative to individual atoms). Iron molecules are not bound at B < ∼ 10 13 G, but become energetically more favorable than individual atoms at larger field strengths.