Before a layout is built, designers need to know how wide a column is. The grid columns calculator takes the container width, the number of columns, the gutter and the outer margin to give the width of one column, the width of spans of 2, 3, 4 and 6 columns and the total width of the gutters.
How the calculation works
- Width of a column = (container width − 2 × outer margin − (columns − 1) × gutter) ÷ columns. The gutters sit between the columns, so there is one fewer gutter than columns.
- Width of a span of k columns = k × column width + (k − 1) × gutter. A span includes the gutters inside it.
- Total gutter width = (columns − 1) × gutter.
- A 12-column grid is the most common because 12 divides by 2, 3, 4 and 6, so a row can hold two, three, four or six equal blocks.
Example
A container of 1,200 px with 12 columns, a 24 px gutter and no outer margin has gutters of 11 × 24 = 264 px in total. The columns share the rest, so each one is (1,200 − 264) ÷ 12 = 78 px. A 3-column span is 3 × 78 + 2 × 24 = 282 px, a 4-column span is 384 px and a 6-column span is 588 px.
Why it matters
Knowing the exact widths helps you to size images, cards and ad slots so they fit the grid, and to check a design file against a coded page. It also shows quickly when the gutters leave too little room for the columns.
Good to know
The result is for a fixed container. A fluid grid changes with the viewport, so calculate the key widths, for example the widest and the narrowest. Remember that the outer margin is counted on both sides. Columns narrower than about 40 px are hard to use on their own, though they can still make a good building block when you group them in spans.
Related tools
The golden ratio calculator gives pleasing proportions for a layout and the aspect ratio calculator keeps the shape of images that fill the columns.