A charging device includes a case that surrounds a charging unit and has
plural ventilating sections, a gas separating unit that varies a
component ratio of the air near an opposed portion of a photosensitive
member and the charging unit, and a gas electrolyzing unit that
electrolyzes moisture of the area near the opposed portion. The gas
separating unit has a nitrogen enriching unit that includes a nitrogen
enriching film set in a ventilating section and a pressurizing chamber
for forming a pressure difference between the inside and the outside of
the case and supplies a nitrogen enriched air to the inside of the case
or an oxygen enriching unit that includes an oxygen enriching film set in
another ventilating section and a depressurizing chamber for forming a
pressure difference between the inside and the outside of the case and
exhausts an oxygen enriched air to the outside of the case.