CalculateMyRoof

Roof Volume Calculator

The volume under a gable or hip roof, what squaring off the hip ends adds, and how much of the attic floor has the headroom the code asks for in a room.

By Marko Visic, BSc Physics · Updated November 25, 2026

Width runs wall to wall across the ridge. Heights run from the top of the wall plates to the roof's theory line. The attic floor, the rafters' depth and the ceiling finish all take some of it.

Ridge height: 28 ÷ 2 × 12 ÷ 12 = 14 ft above the plates.[1]

Volume: 28 × 14 ÷ 2 × 40 = 7,840 cu ft, or 7,840 × 0.3048 × 0.3048 × 0.3048 = 222 cubic meters.

Full headroom: the roof is 7 ft up at 7 × 12 ÷ 12 = 7 ft in from each wall, leaving 28 − 2 × 7 = 14 ft, 14 × 40 = 560 sq ft of floor.[1][2]

Sloped-ceiling minimum: the roof is 5 ft up at 5 × 12 ÷ 12 = 5 ft in from each wall, leaving 28 − 2 × 5 = 18 ft, 18 × 40 = 720 sq ft of floor.[1][2]

A code-minimum room: fits. It needs 70 sq ft where the ceiling is at least 5 ft (met), 7 ft across there (met), and at least 50% of that area, 70 ÷ 2 = 35 sq ft, at 7 ft (met).[2]

How do you calculate roof volume? Multiply the end triangle by the length: half the width times the ridge height times the length. A 28 ft wide, 40 ft long gable at 12:12 rises 28 ÷ 2 × 12 ÷ 12 = 14 ft and holds 28 × 14 ÷ 2 × 40 = 7,840 cu ft.[1] A hip roof of the same size leaves out 28 × 28 × 14 ÷ 12 = 914.67 cu ft at each end: 7,840 − 2 × 914.67 = 6,010.66 cu ft.

Section of a 28 ft wide attic under a 12:12 roof with a 14 ft ridge: 7 ft of headroom over 14 ft of floor, 5 ft over 18 ft
The code's two headroom lines in a gable attic: the full ceiling height over the dark strip of floor, the sloped-ceiling minimum over the lighter one.

Drawing: CalculateMyRoof · CC BY 4.0 · How to reuse

How it works

Heights run from the top of the wall plates to the roof's theory line. The ridge is half the width in from each wall, and a roof rises its pitch for every 12 in of run, so the ridge height is half the width times the pitch over 12.[1]

A gable's volume is its end triangle times its length. A hip roof of one pitch has its ridge along the longer side, and the calculator takes the gable of the same size and subtracts what each hip end leaves out. The same slope sets the headroom: the roof is as high above the plates as its distance from the wall times the pitch over 12, so any height is reached that far in from each wall.[1]

Worked example

The house is 28 ft wide and 40 ft long, with a 12:12 roof. Its ridge is 28 ÷ 2 × 12 ÷ 12 = 14 ft up, and as a gable it holds 28 × 14 ÷ 2 × 40 = 7,840 cu ft, or 7,840 × 0.3048 × 0.3048 × 0.3048 = 222 cubic meters.[1]

As a hip roof it holds 7,840 − 2 × 914.67 = 6,010.66 cu ft, so turning one hip end into a gable adds 914.67 cu ft and both ends 2 × 914.67 = 1,829.34 cu ft.

At 12:12 the roof reaches 7 ft at 7 × 12 ÷ 12 = 7 ft from each wall, leaving 28 − 2 × 7 = 14 ft of floor across, or 14 × 40 = 560 sq ft under the gable.[1][2] The hip's ends slope in too, so its floor is 40 − 2 × 7 = 26 ft long there and 14 × 26 = 364 sq ft. The 5 ft line is 5 × 12 ÷ 12 = 5 ft in, so the floor there is 28 − 2 × 5 = 18 ft wide: 18 × 40 = 720 sq ft under the gable, and 18 × (40 − 2 × 5) = 540 under the hip.[2]

Both attics hold a room of the code's minimum size: 70 sq ft under at least 5 ft of ceiling, 7 ft across, and 70 ÷ 2 = 35 sq ft of it under 7 ft.[2]

Hip to gable: the volume it adds

Over each end, a gable encloses a triangular prism that runs half the width in from the end wall. A hip end encloses a pyramid over the same space instead, and a pyramid holds a third of its box where the prism holds half. The difference is the end's width times itself times the ridge height over 12, which is what the calculator adds back for each end you square off. On a square plan a hip roof is a single pyramid with no ridge.

How much of an attic can be a room

The 2024 IRC asks for a ceiling height of 7 ft for habitable space.[2] Under a sloped ceiling, the required floor area of a room needs at least 5 ft of height everywhere and 7 ft over at least 50% of it.[2] A room needs at least 70 sq ft and 7 ft in every horizontal direction, and the parts lower than 5 ft do not count toward its area.[2]

The heights here run to the roof's theory line above the plates. The attic floor, the depth of the rafters and the ceiling finish all come off them, so read the floor widths as upper limits. Stairs, the floor's strength and the way out in a fire are code questions of their own that this page does not check.

Headroom in a 28 ft wide gable attic by pitch, calculated
PitchRidge (ft) = 28 ÷ 2 × pitch ÷ 12Floor at 7 ft = 28 − 2 × 7 × 12 ÷ pitch[2]Floor at 5 ft = 28 − 2 × 5 × 12 ÷ pitch[2]
6:127none8 ft
7:128.174 ft10.86 ft
8:129.337 ft13 ft
9:1210.59.33 ft14.67 ft
10:1211.6711.2 ft16 ft
12:121414 ft18 ft

Roof volume formulas

  • Ridge height (ft) = width ÷ 2 × pitch ÷ 12.[1]
  • Gable volume (cu ft) = width × ridge height ÷ 2 × length.
  • Each hip end leaves out width × width × ridge height ÷ 12; hip volume = gable volume − 2 × that.
  • Distance in from the wall to a height (ft) = height × 12 ÷ pitch; floor width there = width − 2 × that distance.[1]
  • Cubic meters = cu ft × 0.3048 × 0.3048 × 0.3048.

Common questions

How do you calculate the volume of a hip roof?

Work out the gable of the same width, length and pitch, then take away what each hip end leaves out, the width times itself times the ridge height over 12. The example's hip roof holds 7,840 − 2 × 914.67 = 6,010.66 cu ft.

How much volume does a hip to gable conversion add?

The width times itself times the ridge height over 12 for each end: on the example's 28 ft wide roof, 28 × 28 × 14 ÷ 12 = 914.67 cu ft per end.

How much headroom does an attic room need?

Under the 2024 IRC, 7 ft for habitable space; under a sloped ceiling, at least 5 ft over the room's required floor area and 7 ft over at least 50% of it.[2]

What roof pitch does an attic room need?

It depends on the width: the floor with 7 ft of headroom is the width less 2 × 7 × 12 ÷ pitch.[2] On a 28 ft wide house a 6:12 roof peaks right at that height, and steeper roofs leave the strips in the table above.

How do you calculate attic square footage?

For a room, count the floor under at least 5 ft of ceiling: the code leaves lower parts out of a room's area.[2] The example gable has 720 sq ft of it, 18 × 40 = 720. For vents, the attic ventilation calculator works from the whole attic floor.

Methodology & sources

The ridge height and the slope of the roof come from the framing rules in the U.S. Navy's Builder Basic; the headroom and room rules are the 2024 IRC's, read on ICC Digital Codes. Volumes and floor areas are geometry, calculated on the page with the formulas above; the engine is tested on every build. The page takes one pitch for every slope of the roof and measures to the theory line, before framing and finishes.

Sources

  1. [1] U.S. Navy, Naval Education and Training Professional Development and Technology Center. Builder Basic, NAVEDTRA 14043A (October 2010), Chapter 10: Rough Carpentry. p. 10-51, pp. 10-51 and 10-63, pp. 10-51 and 10-73. Retrieved Nov 20, 2026. media.defense.gov
  2. [2] International Code Council. 2024 International Residential Code, Chapter 3: Building Planning (Oct 2026 version). Sections R312.1, R312.2, R312.3, R313.1. Retrieved Nov 17, 2026. codes.iccsafe.org

Change log: first published November 25, 2026.

Related

By Marko Visic, BSc Physics. Updated November 25, 2026.