Disclosed is a water purifier which is easy to attach and separate a filter by simply rotating an attaching and detaching device by applying a cam, and is capable of reducing the production costs and miniaturizing a product. The water purifier comprises the following: a filter; a main body; and the attaching and detaching device for attaching the filter to and detaching the filter from the main body.