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