Article — How-To · November 12, 2026 · 15 min read
Deck Railing Guide: Materials, Code Height and What It Costs
Deck railing costs $30 to $90 per linear foot installed, or $2,000 to $6,000 for a typical deck: any deck more than 30 in above the ground needs a railing at least 36 in tall, with balusters spaced so a 4 in sphere cannot pass between them.
Deck railing costs $30 to $90 per linear foot installed, or $2,000 to $6,000 for a typical 200 sq ft deck, and the code is clear: any deck more than 30 in above the ground needs a railing at least 36 in tall, with balusters spaced so a 4 in sphere cannot pass between them. Wood is the cheapest at $30 to $60 per linear foot, composite runs $50 to $90, aluminum costs $60 to $90, and cable railing costs $90 to $150. Size the deck with the Deck Calculator, price the full build with the deck build cost guide, and learn the build basics in the deck building dos and donts guide.
How much does deck railing cost?
Deck railing costs $30 to $90 per linear foot installed, and the total for a typical 200 sq ft deck with 60 linear ft of railing runs $2,000 to $6,000. Wood railing is the cheapest at $30 to $60 per linear foot installed: pressure-treated pine costs $15 to $25 per linear foot for materials, cedar costs $25 to $40, and redwood costs $30 to $50. Composite railing costs $50 to $90 per linear foot installed, with materials at $30 to $50 and labor at $20 to $40. Aluminum railing costs $60 to $90 per linear foot installed, and cable railing costs $90 to $150 per linear foot installed, because the stainless steel cables and the tensioning hardware are expensive. Glass panel railing is the most expensive at $120 to $250 per linear foot installed.
The price climbs with the details: a railing with a drink rail or a wide top cap adds $10 to $20 per linear foot, decorative post caps cost $10 to $30 each, and a stair railing costs 20 to 30 percent more per linear foot than a straight run because of the angled cuts and the extra posts. The cheapest way to add railing is to build a wood railing yourself from pressure-treated lumber: materials run $15 to $25 per linear foot, and a 60 linear ft run takes a weekend.
What is the code height for deck railing?
Any deck more than 30 in above the ground needs a railing, and the railing must be at least 36 in tall, measured from the deck surface to the top of the rail. That is the International Residential Code (IRC) requirement, and most local codes follow it, but some cities require 42 in, so check your local building department before you build. A deck less than 30 in above the ground does not legally need a railing, but a railing is still a good idea on any deck where children play or where the edge is hard to see at night. Stair railings have their own rule: the handrail must be 34 to 38 in above the stair nosing, and a guard is required on any stair with a total rise of more than 30 in.
The baluster spacing rule is just as important as the height: balusters must be spaced so a 4 in sphere cannot pass between them, which means the gap between balusters is usually 3 1/2 to 4 in. The rule protects small children, who can slip through a wider gap and fall. The gap between the bottom rail and the deck surface must also be less than 4 in, and the triangular opening between a stair tread, a riser, and the bottom rail must not pass a 6 in sphere. Posts must be spaced no more than 6 ft apart for wood railing, and no more than 5 ft apart for some composite systems — check the manufacturer's instructions, because a railing that is too far between posts flexes and fails the 200 lb load test. The code requires a railing to resist a 200 lb concentrated load applied in any direction at the top of the rail, and a 50 lb per linear foot load along the rail. That is why the post attachment matters more than the rail material: posts must be bolted through the rim joist with 1/2 in carriage bolts or held by code-approved post bases, never fastened with nails or screws alone, and never attached only to the decking boards.
Wood vs metal vs composite vs cable railing compared
Wood railing is the cheapest and the most traditional choice: pressure-treated pine costs $15 to $25 per linear foot in materials, cedar costs $25 to $40, and redwood costs $30 to $50. Wood is easy to cut and customize, it takes paint or stain, and it matches a wood deck perfectly. The downside is maintenance: wood railing needs staining or sealing every 2 to 3 years, it warps and cracks in sun and rain, and a pine railing lasts 10 to 15 years while a cedar railing lasts 15 to 20 years.
Composite railing costs $30 to $50 per linear foot in materials and is made from the same wood-plastic blend as composite decking. It never needs staining, never rots, never splinters, and lasts 25 to 30 years, and it comes in colors that match composite deck boards exactly. The downside is cost and weight: composite railing is twice the price of wood, and the rails are heavy and need closer post spacing, usually 5 ft instead of 6 ft. Aluminum railing costs $40 to $60 per linear foot in materials, is powder-coated in black, white, or bronze, never rusts, never needs painting, and lasts 30 years or more. It is light, strong, and slim, so it blocks less of the view than wood. Cable railing costs $60 to $100 per linear foot in materials, uses horizontal stainless steel cables between slim metal posts, and gives the clearest view of any railing — it is the best choice for a deck with a view.
How far apart should deck railing balusters be?
Deck railing balusters must be spaced so a 4 in sphere cannot pass between them, which in practice means a gap of 3 1/2 to 4 in between balusters. The 4 in sphere rule comes from the International Residential Code, and it exists because a child's head is about 4 in wide — a gap wider than 4 in lets a small child slip through and fall. To set the spacing, use a spacer block cut to the exact gap width: set the first baluster, hold the spacer against it, set the next baluster, and repeat.
The spacing rule applies to every opening in the railing, not just the balusters. The gap between the bottom rail and the deck surface must be less than 4 in, so a child cannot crawl under the railing. The gap between the top rail and the first baluster must also be less than 4 in. On stairs, the triangular opening between the tread, the riser, and the bottom rail must not pass a 6 in sphere, which means the balusters on a stair railing must be closer together than on a level run. Horizontal cable railing is a special case: the cables are usually spaced 3 to 3 1/2 in apart, and some inspectors require a 4 in sphere test on the cables too, so check with your local building department before you install cable railing. The most common spacing mistake is measuring the gap from the center of one baluster to the center of the next, which gives a clear gap that is 2 in wider than the measurement — always measure the clear gap between the edges of the balusters, and when in doubt, go 1/4 in tighter than the maximum.
How do you choose railing for your deck style and climate?
Choose deck railing that matches the deck and the house, because the railing is the most visible part of the deck from the street. A traditional home with a wood deck suits a wood railing with turned balusters or a classic flat top rail, and a painted white railing matches white trim and windows. A modern home with a composite deck suits a slim aluminum railing in black or bronze, or a cable railing that disappears against the view. A coastal home suits aluminum or vinyl railing, which never rusts and never rots in salt air, while a wood railing in a coastal climate needs staining every year and rots in 10 years. A mountain home with snow suits a sturdy wood or composite railing with a wide top rail that sheds snow and gives a place to rest a drink.
Climate decides the material more than style does. In a hot, sunny climate, a dark-colored metal railing reaches 150 degrees Fahrenheit in full sun — choose a light color or a wood top rail that stays cool. In a cold climate, a wood railing swells in winter and shrinks in summer; composite and aluminum move less. In a wet climate, a wood railing rots from the bottom up, so choose composite or aluminum. In a wildfire zone, a metal railing is the safest choice. Check the local code before you choose: some jurisdictions ban horizontal railings where children play, and most require a permit and an inspection for any railing over 30 in above the ground.
Posts, top rails and hardware: what holds a railing together?
The posts hold the railing together, and the post attachment is the single most important part of the whole system. A railing post must resist a 200 lb load applied at the top of the rail, and the only attachment that reliably passes that test is a post bolted through the rim joist with two 1/2 in carriage bolts, or a post held by a code-approved surface-mount post base with structural screws. A post that is screwed only to the decking boards will pull out under a 200 lb load, and a post that is nailed to the rim joist will work loose within a year. Posts should be 4x4 lumber or a manufactured post sleeve over a 4x4 core, spaced no more than 6 ft apart for wood and 5 ft apart for composite. Corner posts and stair posts take the most load and should be bolted on both sides.
The top rail is the part you touch, and it should be comfortable and strong: a wood top rail is usually a 2x6 laid flat, which gives a 5 1/2 in surface to rest a drink on, or a 2x4 on edge, which is easier to grip. The top rail must be continuous across the posts, never jointed between posts, because a joint between posts sags. The bottom rail should sit 2 to 3 in above the deck surface, so water drains away. Use hot-dipped galvanized or stainless steel bolts and screws, never plain steel, and fit a post cap on every post to keep water out of the end grain — a cap costs $5 to $30 and adds 5 years to the life of a post.
How to install deck railing step by step
Installing deck railing takes a weekend for a typical 60 linear ft run, and the steps are: set the posts, fit the rails, install the balusters, and fit the top rail. Start by marking the post positions: posts go at every corner, at each side of the stairs, and every 6 ft along a straight run. Bolt each post through the rim joist with two 1/2 in carriage bolts, or fit a code-approved surface-mount base with structural screws. Check each post with a level on two sides, and brace it temporarily with a 2x4 screwed to the deck. Cut the bottom rail to fit between the posts, leaving a 2 to 3 in gap above the deck, and fasten it with brackets or screws. Cut the balusters to length, set the first one against the post, and use a spacer block to set each one at a 3 1/2 to 4 in gap. Fit the top rail last, running it continuously across the posts, and fasten it with screws driven down through the rail into each post.
The stair railing is the hardest part: measure the angle of the stairs, cut the rails to the same angle, and set the balusters vertically, not at an angle to the rail. A stair handrail must be 34 to 38 in above the stair nosing, and it must be grippable — a 2x6 laid flat is a guard, not a handrail, and a stair handrail needs a rounded or shaped profile that a hand can wrap around. Check the railing with a level and a tape as you go: the top rail must be level on a level run, the baluster gaps must be even, and the posts must be plumb. Test the railing by pushing hard on the top rail: it should not move more than 1/4 in. If it flexes, add a post or tighten the bolts. Do not paint or stain a wood railing until the wood has dried for 4 to 6 weeks after installation, and check the local code before you start — many jurisdictions require a permit and an inspection for deck railing, and an inspection costs $50 to $150 but catches a dangerous mistake before anyone leans on the rail.
Deck railing maintenance and inspection schedule
Inspect your deck railing every spring and every fall, and the inspection takes 15 minutes. Push hard on every post: if a post moves more than 1/4 in, the bolts are loose or the wood is rotted, and the post must be tightened or replaced. Check every baluster: if a baluster is loose, re-fasten it with a longer screw. Check the top rail for sagging, cracking, or splitting, and check the bottom rail for rot where it sits near the deck. Check the hardware for rust, and replace any bolt or screw that is corroded. Check the post caps: a missing cap lets water into the end grain, and the post rots from the top down. Test the railing with the 4 in sphere rule: if a gap has opened up beyond 4 in because a baluster shrank or moved, fix it before a child finds it.
Wood railing needs staining or sealing every 2 to 3 years: clean it, let it dry for 48 hours, and apply two thin coats. Composite and aluminum railing need only a wash with soap and water twice a year, and cable railing needs re-tensioning every 1 to 2 years. A railing that is inspected twice a year and maintained on schedule lasts 20 to 30 years.
Common deck railing mistakes and code violations
The most common deck railing mistake is attaching the posts to the decking boards instead of the rim joist: a post screwed to decking pulls out under a 200 lb load, and it is the single most common reason a railing fails inspection. Bolt the posts through the rim joist with 1/2 in carriage bolts, or use a code-approved surface-mount base. The second mistake is spacing the balusters too wide: a gap over 4 in fails the sphere test and lets a child through, and the fix is to add balusters or rebuild the section. The third mistake is building the railing too short: a 30 in railing on a deck that needs 36 in fails inspection and must be rebuilt, so measure from the deck surface to the top of the rail and confirm the local height requirement before you cut a single board. Read the deck staining and sealing guide before you finish a wood railing, because the stain schedule decides how long the railing lasts.
The fourth mistake is using a 2x6 laid flat as a stair handrail: a flat board is a guard, not a handrail, and the code requires a grippable handrail 34 to 38 in above the stair nosing. The fifth mistake is joining the top rail between posts: always run it continuously and join it over a post. The sixth mistake is using plain steel hardware outdoors: it rusts within a year, while galvanized or stainless hardware lasts the life of the deck. The final mistake is building without a permit where one is required: an unpermitted railing can block a home sale.
Frequently asked questions
Deck railing must be at least 36 in tall, measured from the deck surface to the top of the rail, on any deck more than 30 in above the ground. That is the International Residential Code requirement, and most local codes follow it, but some cities require 42 in, so check your local building department. Stair handrails must be 34 to 38 in above the stair nosing. A deck less than 30 in above the ground does not legally need a railing, but one is still a good idea where children play.
Deck balusters must be spaced so a 4 in sphere cannot pass between them, which means a clear gap of 3 1/2 to 4 in. The rule protects small children, whose heads are about 4 in wide. The gap between the bottom rail and the deck surface must also be less than 4 in, and the triangular opening between a stair tread, a riser, and the bottom rail must not pass a 6 in sphere. Always measure the clear gap between the edges of the balusters, and use a spacer block for even spacing.
Deck railing costs $30 to $90 per linear foot installed: wood is the cheapest at $30 to $60, composite costs $50 to $90, aluminum costs $60 to $90, cable costs $90 to $150, and glass costs $120 to $250. A typical 200 sq ft deck with 60 linear ft of railing costs $2,000 to $6,000 total. Stair railing costs 20 to 30 percent more per linear foot than a straight run, and a gate costs $200 to $500.
Attach deck railing posts by bolting them through the rim joist with two 1/2 in carriage bolts, or by using a code-approved surface-mount post base with structural screws. Never attach a post only to the decking boards, and never fasten a post with nails or screws alone — a post attached that way pulls out under a 200 lb load. Space posts no more than 6 ft apart for wood railing and 5 ft apart for composite. Use galvanized or stainless steel hardware, and fit a post cap on every post.
Aluminum and composite are the best deck railing materials for low maintenance. Aluminum railing costs $60 to $90 per linear foot installed, never rusts, never needs painting, and lasts 30 years or more with only a wash twice a year. Composite railing costs $50 to $90 per linear foot installed, never needs staining, never rots, and lasts 25 to 30 years. Wood is the cheapest at $30 to $60 but needs staining every 2 to 3 years and lasts only 10 to 20 years. Cable railing gives the clearest view but needs re-tensioning every 1 to 2 years.
Keep reading
Deck Building Do's and Don'ts: 18 Rules From the Pros
Do's & Don'tsA deck rarely fails at the surface first. Footings, ledger flashing, joist spacing, drainage and fastener choices decide whether it stays level and solid. Eighteen rules to follow — and the shortcuts to refuse.
Read the articleDeck Staining and Sealing: When to Restain, What It Costs, and How to Make It Last
How-ToRestain a wood deck every 2 to 3 years, or when water stops beading on the surface — a 300 sq ft deck costs $300 to $700 DIY or $700 to $1,500 professionally, and preparation is most of the job.
Read the article