Engineering calculator
Octagon and gazebo calculator
An octagon's side is its width across the flats × 0.4142, and every joint is cut 22.5°. A 12 ft octagon has sides of 4 ft 11 5/8 in, measures 12 ft 11 7/8 in across the corners and covers 119.3 sq ft. Enter any one size — side, width, diameter, radius or area — for 5 to 12 sides, and this calculator draws the plan with every angle and the miter joint, then frames the floor and a gazebo roof, in 3D with a cut list.
Enter your sizeCode note. The shape, the lengths and the angles are geometry. A deck or gazebo floor is framed like a freestanding deck under IRC 2021 Section R507: this page checks the joist span (Table R507.6) and the decking (Table R507.7) but does not size the footings, posts or rims. The roof's hips, hub and connections are laid out here, not designed for snow or wind: check them, and whether you need a permit, with your building department or an engineer.
Quick answers
How do you calculate an octagon?
How long is each side of a 12 ft octagon, and what angle do you cut? Measured across the flats (its width), a regular octagon's side = width × tan 22.5° = width × 0.4142; across the corners = width ÷ cos 22.5° = width × 1.0824; and the area = 2 (1 + √2) × side² = 0.8284 × width². Every piece is cut 22.5° off square at both ends (180° ÷ 8), so each corner closes at 135°. A 12 ft octagon: 144 in × 0.4142 = 4 ft 11 5/8 in a side, 144 in × 1.0824 = 12 ft 11 7/8 in across the corners, and 0.8284 × 144 sq ft = 119.3 sq ft. Cut from 1½ in rim boards, that side is the long point on the outside face; the inside face is 2 × 1½ in × 0.4142 = 1¼ in shorter, 4 ft 10 3/8 in.
Octagon sizes: side, diameter and area by width
A regular octagon by its width across the flats, with the short point of a 1½ in (2×) rim board when that width is the outside of the frame. Every board end is cut 22.5°.
| Across flats | Side | Across corners | Area | 2× rim, short point |
|---|---|---|---|---|
| 4 ft | 1'-7 7/8" | 4'-3 15/16" | 13.3 sq ft | 1'-6 5/8" |
| 6 ft | 2'-5 13/16" | 6'-5 15/16" | 29.8 sq ft | 2'-4 9/16" |
| 8 ft | 3'-3 3/4" | 8'-7 15/16" | 53.0 sq ft | 3'-2 1/2" |
| 10 ft | 4'-1 11/16" | 10'-9 7/8" | 82.8 sq ft | 4'-0 7/16" |
| 12 ft | 4'-11 5/8" | 12'-11 7/8" | 119.3 sq ft | 4'-10 3/8" |
| 14 ft | 5'-9 9/16" | 15'-1 13/16" | 162.4 sq ft | 5'-8 3/8" |
| 16 ft | 6'-7 1/2" | 17'-3 13/16" | 212.1 sq ft | 6'-6 5/16" |
| 20 ft | 8'-3 7/16" | 21'-7 3/4" | 331.4 sq ft | 8'-2 3/16" |
Hexagon, octagon and other polygon angles
Multiply the width across the flats by these to get the side, the diameter across the corners and the area. On an odd number of sides there is no opposite flat: the "width" is then the diameter of the circle that touches every flat.
| Sides | Cut each end | Corner angle | Side = width × | Corners = width × | Area = width² × |
|---|---|---|---|---|---|
| 5 · pentagon | 36° | 108° | 0.7265 | 1.2361 | 0.9082 |
| 6 · hexagon | 30° | 120° | 0.5774 | 1.1547 | 0.8660 |
| 7 · heptagon | 25.7° | 128.6° | 0.4816 | 1.1099 | 0.8428 |
| 8 · octagon | 22.5° | 135° | 0.4142 | 1.0824 | 0.8284 |
| 9 · nonagon | 20° | 140° | 0.3640 | 1.0642 | 0.8189 |
| 10 · decagon | 18° | 144° | 0.3249 | 1.0515 | 0.8123 |
| 12 · dodecagon | 15° | 150° | 0.2679 | 1.0353 | 0.8038 |
Based on your result
What you'll need for an octagon gazebo
Every rim, plate and fascia board ends in the same 22.5° cut, so set the saw once, cut one test corner, and check it closes before you cut the stack.
- Rim boards
- The ring under the floor, both ends cut 22.5°
- Calculate above
- Joists
- Inside the rim at your spacing, ends cut to the rim
- —
- Deck boards
- Laid long across the frame and trimmed to the rim
- —
- Joist hangers Amazon
- Square where a joist meets a flat, skewed at an angled rim
- —
- Deck screws Amazon
- Two into every joist under each board
- —
- Piers
- One under each corner
- —
- Posts
- One at each corner of a gazebo
- —
- Hip rafters
- One up every corner to the center hub
- —
- Roofing
- Shingles and underlayment for the roof area
- —
- Speed square Amazon
- Marks the 22.5° corner cuts and the hip plumb cuts
- 1
As an Amazon Associate I earn from qualifying purchases.
The maths
Octagon area, side length and angle formulas
Everything in a regular polygon follows from one angle, φ = 180° ÷ n: half the angle each side takes up at the center, and the cut on each end of a board. For an octagon, φ = 22.5°.
side = 2a × tan φ
radius = a ÷ cos φ; across corners = 2 × radius
area = n × a² × tan φ = ½ × perimeter × a
cut at each end = φ off square; corner = 180° − 2φ
short point = long point − 2 × thickness × tan φ
hip slope = face pitch × cos φ; hip run = radius
- 01
Find the apothem
Whatever you measured, the calculator first finds the distance from the center to the middle of a flat. Width across flats is twice it; a side is 2a × tan φ; across the corners is 2a ÷ cos φ; from an area, a = √(area ÷ (n × tan φ)).
- 02
Cut the ring
Each board covers one side. Its outside face is the side length (the long point); the inside face is shorter by twice the board's thickness × tan φ — 1¼ in on a 2× octagon rim. A second ply inside the first is shorter again by the same amount.
- 03
Frame the floor
Joists run square to one flat at your spacing, out from the center line, each cut where it meets the inside of the rim: square against a flat, 45° against the angled sides of an octagon. Deck boards run the other way, parallel to a flat.
- 04
Run the hips
A gazebo roof is a hip roof with one hip per corner. The hip runs out to the corner, 1 ÷ cos φ times as far as a face runs (8.2 % farther on an octagon), so it is flatter: an 8 / 12 face makes a 7.39 / 12 hip on an octagon, laid out on the framing square with 13 on the blade instead of 12.
- 05
Check the code
The joist span is read from IRC 2021 Table R507.6 for your lumber and spacing, the decking from Table R507.7, the roof slope for shingles from R905.2.2 and the hip birdsmouth from R802.6 and R802.7.1. A hip-only roof is outside the code's rafter tables: the footings, rims, hips and roof connections are yours to size with the building department.
Good to know
Octagon and gazebo questions
22.5° off square on both ends of every piece: 180° ÷ 8. Two pieces meet at a 135° corner, and eight corners close the ring. A plate or trim board that lies flat is cut with the miter set to 22.5°. A rim joist stands on edge in the frame: lay it flat on the saw and tilt the blade to a 22.5° bevel (on a circular saw, set the shoe to 22.5° and cut square across the face). A hexagon is 30°, a pentagon 36°, a dodecagon 15°.
Multiply the width across the flats by 0.4142 (tan 22.5°): a 12 ft octagon has 4 ft 11 5/8 in sides. From the diameter across the corners, multiply by 0.3827 (sin 22.5°): 12 ft 11 7/8 in × 0.3827 gives the same 4 ft 11 5/8 in.
Area = 2 (1 + √2) × side², about 4.8284 × side², or 0.8284 × the width across the flats squared. A 12 ft octagon covers 0.8284 × 144 = 119.3 sq ft; one with 5 ft sides covers 4.8284 × 25 = 120.7 sq ft.
Draw a square as wide as the octagon across its flats and mark 0.2929 of that width in from each corner along both sides — 3 ft 6 3/16 in on a 12 ft square. Join the eight marks: the cut-off corners leave a regular octagon with sides 0.4142 of the width.
About 8.2 %: across corners = width ÷ cos 22.5° = width × 1.0824. A 12 ft octagon is 12 ft 11 7/8 in corner to corner, which is the circle its corner piers sit on.
Flatter than the faces: hip pitch = face pitch × cos 22.5° = face pitch × 0.9239, because the hip runs out to the corner. An 8 / 12 roof has 7.39 / 12 hips. On a framing square, lay out the hip with the face pitch on the tongue against 13 on the blade (12 ÷ cos 22.5° = 12.99).
Often, but not always. IRC 2021 R105.2 exempts a one-story detached accessory structure up to 200 sq ft, and a deck up to 200 sq ft that is no more than 30 in above grade, not attached to the house and not serving its exit door. The work must still meet the code, and many towns change these limits, so ask your building department before you dig.
Square to one pair of flats, at 16 in on center for 5/4 decking (IRC Table R507.7). The joists against the flats get square ends; those that meet the angled sides of an octagon are cut 45° and hung in skewed hangers. The deck boards then run parallel to the flats the joists start from.