A water purifier according to an embodiment of the present invention may include a housing accommodating components for generating cold water and/or hot water; a water cock which protrudes from a front surface of the housing, the water cock being configured to discharge the cold water or the hot water; a control panel which is provided so as to input a command for discharging the cold water or the hot water; a sterilization module which is detachably mounted on the water cock, the sterilization module being configured to emit ultraviolet rays for sterilizing the inside of the water cock; and a fastening part which is formed on the water cock and the sterilization module, respectively, so that the sterilization module can be attached to and detached from the water cock.