The California Residential Code sets the rules for residential deck railings:
Most attached and elevated decks need a permit, and the inspector checks railing height and spacing before final approval.
Deck stairs with four or more risers need a handrail. Set the handrail 34 to 38 inches above the stair nosing, measured vertically. Use a graspable profile: a round handrail must be 1 1/4 to 2 inches in diameter.
Run the handrail continuously for the full length of the stairs, and end it at a post or return it to the wall. A redwood or black steel handrail can match the deck railing for a consistent look.
Match the railing to how you use your outdoor space:
Every railing must meet code for safety. Confirm the height rule with your city, since requirements vary by jurisdiction.