The code for pool fence are different by location and jurisdiction, because it is typically regulated by local building codes or safety regulations.
In the United States, the International Swimming Pool and Spa Code (ISPSC) and the International Residential Code (IRC) provide guidelines for pool fencing. However, individual states and municipalities may have additional requirements or variations of these codes.
Generally, pool fence should be at least 48 inches high and have a self-closing and self-latching gate. The fence should not have any gaps larger than four inches, and any horizontal members should be spaced at least 45 inches apart to prevent climbing. The gate should swing outward, away from the pool, and the latch should be located at least 54 inches above the ground.
It is necessary to check your local building codes and regulations to ensure that your pool fence meets all requirements for your specific location. A qualified pool contractor or building inspector can provide guidance and ensure that your pool fence is installed correctly and meets all necessary safety standards.