Disclosed herein is an ultraviolet sterilizer having a watertight function. The ultraviolet sterilizer includes a housing and an ultraviolet sterilization unit. The housing has an inlet through which ballast water is drawn into the housing, and an outlet through which the ballast water is discharged from the housing after the ballast water has been sterilized. The ultraviolet sterilization unit is provided in the housing and includes an ultraviolet lamp applying ultraviolet rays to the ballast water to sterilize the ballast water. The ultraviolet sterilizer further includes a cap which supports each of the opposite ends of the ultraviolet sterilization unit and is watertightly coupled to the housing. Thus, even if the ultraviolet sterilization unit is damaged, ballast water is prevented from being drawn into a reception space which contains external devices, and explosive gas which may cause the ultraviolet sterilizer to explode is also prevented from entering the cap.