We study equilibrium properties of partially ionized hydrogen atmospheres and subphotospheric layers of weakly (with magnetic field B ≪ 109G) and strongly (B ≫ 1010G) magnetized neutron stars. In both weak- and strong-field cases, the ionization degree, atomic occupation numbers, and equation of state are calculated. These results are used to calculate opacities of neutron-star atmospheres.