As defined by the International Residential Code (IRC), a balcony is supported only on one side where it attaches to an upper story of a building. In this respect, it varies from porches or patios, which may be supported on all sides with beams or foundations that rest on the ground. Besides the IRC, local building ordinances may impose additional regulations on the construction of a balcony, with specific requirements for its railing. Therefore, check your local building laws before beginning design and construction of a balcony and its railing.
If your local laws follow the International Residential Code, then balconies in your area that are 30 inches or more above the surrounding floor must have guardrails. Even if your balcony has additional supports -- potentially categorizing it as a porch or deck -- it must have guardrails based on the same 30-inch rule. If you build a bench or level seating area along the edge of the balcony, it cannot count as the guardrail itself if the balcony floor is located 30 inches or higher above the surrounding ground.
Guardrails must be installed to reach a height of 36 inches above the balcony floor. The guardrail may be solid, as in the case of translucent or transparent plexiglas or plastic walls, popular on more modern buildings. Otherwise, if the guardrail is composed of railings or balusters, these must be spaced at intervals of no more than 4 inches. Likewise, if the railings do not continue all the way to the balcony floor, instead meeting a horizontal toe-board piece, the gap between the floor and the lower edge of the toe-board cannot be greater than 4 inches.
The "railings" that line a balcony, as they are commonly termed, are technically known as guardrails. They should not be confused with handrails, which are the requisite structures along stairways. If a balcony has stairs with four or more risers, then the guardrails must meet the same requirements as handrails. The IRC requires that if such handrails have a circular cross-section, they must be at least 1 1/4 inches in diameter and no more than 2 inches in diameter. If square, these handrails must be no more than 1 1/2 inches on each side.
When building a balcony, many communities require a preliminary inspection prior to the start of construction as well as a building inspection at the completion of the work. In addition, the International Code Council recommends that homeowners and building managers have balconies and their railings inspected periodically, especially those made of wood, a material highly susceptible to weathering and rot.