The utility model discloses a pet fence capable of being freely spliced and shaped, which comprises a plurality of fence plates, two adjacent fence plates are rotatably connected through a rotating shaft module, and the rotating shaft module comprises a first shaft body, a second shaft body, a top connecting piece and a bottom connecting piece, the upper ends of the first shaft body and the second shaft body are rotatably connected with the two sides of the lower end face of the top connecting piece respectively, the lower ends of the first shaft body and the second shaft body are rotatably connected with the two sides of the lower end face of the bottom connecting piece respectively, and the first shaft body and the second shaft body are arranged on the two sides of the fence plate respectively. After the two adjacent fence plates are rotated to be attached and folded through the rotating shaft module, the top connecting piece and the bottom connecting piece are arranged on the same side of the two adjacent fence plates. The two adjacent fence plates are connected through the rotating shaft modules, so that the two adjacent fence plates can be folded in parallel when the fence is not used, disassembly is not needed, operation is more convenient, the occupied space is small after the fence plates are folded, the fence plates can be used after being pulled open in the later period, and operation is more convenient.