The invention relates to an offshore wind power generator with a separating function. The offshore wind power generator comprises a seabed anchor, connecting piles, a base, a floating body, a tower tube, a power generating unit, a driving mechanism, a first fixing mechanism and a second mechanism, wherein the first fixing mechanism comprises a supporting rod, a push rod, a first rack, a second rack and a circular gear, the second fixing mechanism comprises a force sensor, a winding engine and a stay cord, and the driving mechanism comprises blades, a flange disc and a transmission shaft. According to the offshore wind power generator with the separating function, in normal circumstances, the tower tube of the wind power generator is fixed in the base, and when the sea level extremely rises due to conditions such as rainstorms and tsunami, the tower tube can float on the sea surface under the action of the floating body. In addition, the wind power generator is provided with an anti-collision mechanism, and a protective effect on the wind power generator itself and a ship can be achieved when the ship is collided.