From the 2018 International Residential Code unless otherwise indicated.
R312.1.1 - Where Required
Guards shall be provided for those portions of open-sided walking surfaces, including stairs, ramps and landings, that are located more than 30 inches (762 mm), measured vertically to the floor or grade below at any point within 36 inches (914 mm) horizontally to the edge of the open side. Insect screening shall not be considered as a guard.
R312.1.2 - Height
Required guards at open-sided walking surfaces, including stairs, porches, balconies or landings, shall be not less than 36 inches (914 mm) in height as measured vertically above the adjacent walking surface or the line connecting the nosings.
R312.1.3 - Opening Limitations
Required guards shall not have openings from the walking surface to the required guard height which allow passage of a sphere 4 inches (102 mm) in diameter.