Pergola Calculator
Estimate the posts, beams, rafters, top slats and concrete for a freestanding pergola from its size, rafter spacing and overhang, with stock lumber lengths to buy.
By CalcBuilt Editorial TeamUpdated September 9, 2026Formulas checked against manufacturer specs, see how we calculate.
Results
- Posts
- 4 posts
- 6x6, 11 ft each: 8 ft above grade plus 3 ft in the ground. Buy 12 ft UC4B ground-contact posts
- Beams
- 2 beams
- 14 ft each, length plus both overhangs. Usually doubled 2x10 (two boards per beam); buy 14 ft stock.
- Rafters
- 10 rafters
- 12 ft each at 16 in on center; 2x8, buy 12 ft stock
- Concrete
- 8 bags
- 2 x 50 lb (23 kg) bags per post, about 0.11 cu yd. Crown it above grade. Warning: 2 bags fills a 10 in hole only about 2 ft deep; 3 ft in the ground takes 3 bags in a 10 in hole and 5 in a 12 in hole
- Hardware
- 8 bolts
- 8 x 1/2 in hot-dipped galvanized carriage bolts (2 per notched post) for the beams, and 20 H2.5A hurricane ties or 6 in structural screws for the rafters. Posts on piers instead of in the ground need 4 uplift-rated standoff bases (Simpson ABU) on 5/8 in anchors. Planning estimate; local code and permit rules govern.
Pergola formula
Posts = 4 (6 when the length is over 14 ft); Post length = height + 3 ft in the ground
Beams = 2, each Length + 2 x overhang
Rafters = Length (in) / rafter spacing, rounded up, + 1, each Width + 2 x overhang
Slats = Width (in) / slat spacing, rounded up, + 1, each Length + 2 x overhangWorked example
A 16 x 12 ft pergola with 24 in rafter spacing, 1.5 ft overhangs and slats 12 in on center: the length is over 14 ft, so 6 posts. Beams: 2, each 16 + 3 = 19 ft, so buy 20 ft stock. Rafters: 16 x 12 / 24 = 8, plus 1 = 9, each 12 + 3 = 15 ft, so buy 16 ft boards. Slats: 12 x 12 / 12 = 12, plus 1 = 13, each 19 ft.
With 8 ft to the beams the posts are 8 + 3 = 11 ft, so buy six 12 ft 6x6s. At 2 bags per post, 12 bags of concrete.
Quick reference
| Length | Posts | Beam length | Rafters at 16 in | Rafters at 24 in |
|---|---|---|---|---|
| 8 ft | 4 | 10 ft | 7 | 5 |
| 10 ft | 4 | 12 ft | 9 | 6 |
| 12 ft | 4 | 14 ft | 10 | 7 |
| 14 ft | 4 | 16 ft | 12 | 8 |
| 16 ft | 6 | 18 ft | 13 | 9 |
| 20 ft | 6 | 22 ft | 16 | 11 |
How to estimate pergola lumber
A freestanding pergola is four posts, two beams running the length on top of the posts, and rafters crossing the beams. Beams are the length plus the overhang on each end; rafters are the width plus overhangs. Divide the length in inches by the rafter spacing, round up and add one for the last rafter. Pergolas longer than about 14 ft get a middle pair of posts so the beams do not sag.
Round every piece up to the next even stock length; yards carry 2x lumber in 2 foot steps to 16 feet, with 18 and 20 foot 2x10s on order. A decorative tail cut needs a few extra inches at each end, so a 14 foot beam comes from 16 foot stock unless the ends stay plain.
Posts, footings and hardware
Posts either go 3 feet into the ground in concrete or stand on piers with uplift-rated standoff bases (Simpson ABU66Z on a 5/8 inch anchor). Posts on bases rely on the beam bolts and rafter ties against uplift; a pergola roof is mostly sail. Only UC4B ground-contact treated posts go in the ground; cedar and redwood belong on bases. Dig below the frost line; a 4x4 racks over 8 feet tall, so use 6x6.
Notch the 6x6 so the beam bears on wood, then through-bolt it with two 1/2 inch carriage bolts; a beam bolted to the side of an unnotched post is prohibited (DCA 6 Figure 7). Tie each rafter to the beam with an H2.5A hurricane tie or a 6 inch structural screw. A doubled 2x10 on 12 foot post centers carries rafters and 2x2 slats. In snow country, or under shade cloth that holds snow, size the beam from DCA 6 Table 3 or have it engineered.
What this calculator leaves out
Not counted: gravel under each post, and the ledger and flashing if one side attaches to the house. R105.2 exempts a detached pergola of 200 sq ft or less; anything larger or attached to the house gets a permit and a footing inspection. Accessory-structure setbacks run 3 to 5 feet from side and rear lines. Call 811 before digging.
Mistakes that cost money
- 4x4 posts over 8 ft tall rack in the first windstorm; use 6x6, which can also be notched so the beam bears on wood.
- A beam bolted to the side of an unnotched post is prohibited (DCA 6 Figure 7); notch the 6x6 so the beam bears, then through-bolt.
- Posts on deck blocks or cheap EPB bases lift in wind; use uplift-rated standoff bases (Simpson ABU66Z) on 5/8 in anchors, or bury the posts.
- Over 200 sq ft or attached to the house needs a permit (R105.2); a 20 x 12 pergola is 240 sq ft and gets inspected.
- Two bags fills a 10 in hole 2 ft deep; the 3 ft depth here takes 3 bags, or 5 in a 12 in hole.
- Cedar posts set in concrete rot at grade within 10 years; bury only UC4B treated posts, and stand cedar on standoff bases above a pier.
Key facts
- A 4x4 post is 3.5 in square and a 6x6 is 5.5 in square; 6x6 posts look proportionate and resist racking on pergolas over about 10 ft.
- The IRC exempts one-story detached accessory structures of 200 sq ft or less from a building permit, but many cities require one for any pergola attached to the house.
- Set posts at least 24 in deep and below the local frost line; this estimate allows 3 ft of post in the ground.
- Rafters 12 in on center cast about twice the shade of rafters at 24 in; slats on top of the rafters add shade without more posts or beams.
- Dimensional lumber is sold in 2 ft steps from 8 to 20 ft, so a beam that works out to 19 ft is bought as a 20 ft board.
Frequently asked questions
Do I need a permit for a pergola?
Not for a detached, one-story pergola of 200 sq ft or less under IRC R105.2, which covers a 12 x 16. Anything larger, or any pergola attached to the house, needs a permit and a footing inspection. Zoning setbacks, height limits and HOA rules apply either way, so ask the building department before digging, and call 811 for a free utility locate.
How many rafters for a 12 ft pergola?
At 16 in on center, 12 x 12 / 16 = 9, plus 1 = 10 rafters. At 24 in on center it is 7 rafters.
How long should pergola posts be?
Add about 3 ft to the height of the beams for the part in the ground. An 8 ft high pergola uses 11 ft of post, so buy 12 ft 6x6s.
What size lumber should I use for a pergola?
6x6 posts, doubled 2x10 beams and 2x8 rafters are the usual choice for a 10 to 12 ft pergola. Small pergolas under 10 ft can use 4x4 posts, 2x8 beams and 2x6 rafters. Check span tables for anything larger.
Sources and references
Next steps for this project
The usual order for a framing, decks & fences project. See all framing, decks & fences calculators.
Embed this calculator
Results are estimates based on standard formulas and typical product specifications. Confirm quantities with your supplier and local code before ordering.