An optical scanner, comprising: a frame configured to accommodate a plurality of scanning optical systems for emitting latent-image-writing light toward an image carrier and provided with a plurality of emission ports through which the light emitted from the scanning optical systems passes; a plurality of dust-proof glasses configured to cover the emission ports; and a plurality of automatic cleaning units respectively driven by one common drive source to clean the dust-proof glasses, wherein each of the automatic cleaning units includes a screw shaft arranged to extend along each of the dust-proof glasses and rotationally driven by the one common drive source, a holding member to which the screw shaft is threadedly coupled, and a cleaning member held by the holding member and configured to, when the screw shaft is rotationally driven, move together with the holding member along each of the dust-proof glasses to clean each of the dust-proof glasses, wherein each of the automatic cleaning units includes a guide member arranged at the opposite side of each of the dust-proof glasses from the screw shaft so as to extend along each of the dust-proof glasses, a sliding portion installed in the holding member at the opposite side of each of the dust-proof glasses from the screw shaft and configured to slidably engage with the guide member, a swing mechanism installed in an engaging section of the sliding portion and the guide member and configured to, when the holding member is moved forward or backward by the rotational driving of the screw shaft, swing the sliding portion in a direction opposite to a moving direction of the holding member, and a displacement conversion mechanism installed in the engaging section of the sliding portion and the guide member and configured to convert a swing direction displacement between the sliding portion and the guide member, which is generated when the sliding portion is swung by the swing mechanism, to a height direction displacement of the sliding portion with respect to the guide member, wherein, when the holding members of the automatic cleaning units are moved by rotationally driving the screw shafts of the automatic cleaning units at the same time, at least one of the automatic cleaning units causes the height of the sliding portion thereof displaced with respect to the guide member by the displacement conversion mechanism to become different from the height of the sliding portions of the remaining automatic cleaning unit, thereby causing the height of the cleaning member thereof with respect to the corresponding dust-proof glass to become different from the height of the cleaning members of the remaining automatic cleaning unit with respect to the corresponding dust-proof glass. a frame configured to accommodate a plurality of scanning optical systems for emitting latent-image-writing light toward an image carrier and provided with a plurality of emission ports through which the light emitted from the scanning optical systems passes; a plurality of dust-proof glasses configured to cover the emission ports; and a plurality of automatic cleaning units respectively driven by one common drive source to clean the dust-proof glasses, wherein each of the automatic cleaning units includes a screw shaft arranged to extend along each of the dust-proof glasses and rotationally driven by the one common drive source, a holding member to which the screw shaft is threadedly coupled, and a cleaning member held by the holding member and configured to, when the screw shaft is rotationally driven, move together with the holding member along each of the dust-proof glasses to clean each of the dust-proof glasses, wherein each of the automatic cleaning units includes a guide member arranged at the opposite side of each of the dust-proof glasses from the screw shaft so as to extend along each of the dust-proof glasses, a sliding portion installed in the holding member at the opposite side of each of the dust-proof glasses from the screw shaft and configured to slidably engage with the guide member, a swing mechanism installed in an engaging section of the sliding portion and the guide member and configured to, when the holding member is moved forward or backward by the rotational driving of the screw shaft, swing the sliding portion in a direction opposite to a moving direction of the holding member, and a displacement conversion mechanism installed in the engaging section of the sliding portion and the guide member and configured to convert a swing direction displacement between the sliding portion and the guide member, which is generated when the sliding portion is swung by the swing mechanism, to a height direction displacement of the sliding portion with respect to the guide member, wherein, when the holding members of the automatic cleaning units are moved by rotationally driving the screw shafts of the automatic cleaning units at the same time, at least one of the automatic cleaning units causes the height of the sliding portion thereof displaced with respect to the guide member by the displacement conversion mechanism to become different from the height of the sliding portions of the remaining automatic cleaning unit, thereby causing the height of the cleaning member thereof with respect to the corresponding dust-proof glass to become different from the height of the cleaning members of the remaining automatic cleaning unit with respect to the corresponding dust-proof glass.