Deck railings and guardrails provide a barrier that keeps people and objects on a deck, rather than letting them fall off. In order to provide the best chance of protection, the railings have to meet minimum standards. Each locality will have its own variations, but a basic code is set out by the International Residential Code (IRC), which covers all construction aspects to create a uniform set of safety standards for homes.
Deck railings installed on decks that are more than 2.5 feet off the ground must be at least 3 feet high. Higher decks require higher railings. While the 2.5-feet figure is common, the North American Deck and Railing Association (NADRA) says some areas may require railings on decks that are only 1.5 feet off the ground.
Spaces between the balusters--the railings that fill in the space between the top handrail and the deck--should be less than 4 inches wide. You can use panels to cover the spaces, but if you want to install glass panels, use tempered glass. Regular glass can break into shards and cut you, but tempered glass breaks into smaller, non-shard pieces.
You must assume that anyone on your deck is going to lean against the railing. This means the railing needs to be able to support a minimum load. This should be at least 200 lbs per side per the IRC (Inspectapedia notes this is a concentrated load, not spread out evenly); however, localities may have more restrictive codes, such as 20 lbs per foot of railing. Balusters and other infill have their own requirement of 50 lbs per square foot. Note that the connections between the rails, balusters and support posts can literally make or break a deck; NADRA notes that in 2003, a woman fell 14 feet and died after weak railing connections broke.