An opening and closing device includes a mask 13 having an inner surface 13f in which an expiratory hole 13a is opened, and an opening and closing mechanism 15 for opening and closing the expiratory hole 13a. The expiratory valve 15 is movable along the inner surface 13f between a first position and a second position each having a different aperture area of the flow hole 13a. When a direction perpendicular to a moving direction of the expiratory valve 15 is defined as a width direction W, an aperture length L W of the flow hole 13a in the width direction W increases or decreases from the first position toward the second position.