8px Grid Calculator

Tell it the container, the columns and the gutters, and it gives the column width and the nearest container where every column is a whole number of grid units.

How it works

A column grid starts with a container width. The side margins and the gutters between columns are fixed, and the columns share what is left. Twelve columns in 1200px with 24px gutters leave 1200 minus 11 × 24, which is 936px, so each column is 78px.

78 is not a multiple of 8. The page works out the nearest columns that are, 72px and 80px, and the container widths that give them: 1128px and 1224px.

In snap mode it rounds any size to the grid and gives the lines either side. Everything is worked out in your browser.

How to use it

  1. 1 Choose Column grid, or Snap a size for a single value.
  2. 2 Type the container width, the number of columns, the gutter and the side margin.
  3. 3 Change the grid from 8 if your system uses 4 or another unit.
  4. 4 Read the column width and the nearest containers on the grid, and copy the CSS.

Good to know

  • If the container has to stay as it is, change the gutter instead. Twelve columns in 1200px with 16px gutters give 85.33px; with 32px gutters, 70.67px.
  • Common screen widths such as 320, 768, 1024, 1280 and 1440 are all multiples of 8, which is one reason the 8px grid took hold.
  • The table under the results gives the width of an element that spans 2, 3 or more columns, gutters included.

Browser support

  • Chrome 94 and later
  • Firefox 93 and later
  • Safari 16.4 and later
  • Edge 94 and later

These are the oldest versions with everything the tool uses. They are worked out from the tool itself, so they change when it does.

Version numbers checked on 2026-09-04.

Fitting a 12-column grid to a 1200px layout

A design brief says: content 1200px wide, 12 columns, 24px gutters, on an 8px grid. The first sum is the column width. Eleven gutters sit between twelve columns, so they take 264px. The remaining 936px divided by 12 is 78px per column. That is fine for the browser, but in a design file it means a three-column card is 282px wide and nothing lines up with the 8px grid lines.

There are three ways out, and the calculator shows the first directly. Change the container: columns of 72px need 12 × 72 plus 264, which is 1128px, and columns of 80px need 1224px. Either one puts every column and every span on the grid. Change the gutter: with 32px gutters the columns are 70.67px, and with 16px gutters 85.33px, neither of which helps here, so this time the container is the thing to change. Or change the number of columns: 1200px with 24px gutters and 8 columns gives 129px.

Side margins come off first. If the 1200px container keeps 32px of padding on each side, the content is 1136px, and the columns are 72.67px. The nearest container with whole 72px columns is 1192px. That is often the easiest fix: keep the outer width round for the design, and let the margins and the container agree with each other.

Snap mode covers the smaller cases. A developer receives a design with a 13px gap. On an 8px grid the lines either side are 8 and 16, and the nearest is 16. A 12px gap is exactly between them, and the calculator rounds it up. Many teams use a 4px half-step for small gaps like this, and setting the grid to 4 shows that 12px is already on it.

The calculator has limits. It plans a single breakpoint; on screens narrower than the container, the columns shrink and leave the grid, and that is expected. It treats gutters as equal, and does not handle a layout where the outer gutters differ from the inner ones, except through the side margin. Browsers place fractional columns with subpixel layout, so 78px columns look fine on screen even though they are off the grid. And the grid is a guide for consistency, not a rule every element must follow.

Frequently asked questions

Why use an 8px grid?

Multiples of 8 divide evenly by 2 and 4, so halves and quarters stay whole pixels, and they stay whole on screens that scale by 1.5, 2 or 3. It also cuts down choices: a gap is 8, 16 or 24, never 13 or 19.

Do the columns need to be multiples of 8?

Not always. With CSS grid and 1fr columns, the browser shares the width whatever it is. Whole grid units matter most in the design file, where a component should line up with the columns, and for fixed-width layouts.

What does the CSS do?

It makes the container a grid with the number of equal columns you chose and your gutter as the gap. box-sizing: border-box keeps the side margins inside the maximum width, so the column sums on this page match the browser.

Related tools

Your files are processed on your device and are not uploaded. You can verify this in your browser’s developer tools under the Network tab.