Design tools

Grid Calculator

Grid Calculator

Column width, spans and CSS for a column grid on an 8-point baseline.

About this tool

About Grid Calculator

Set up a layout grid you can actually build. Enter the container width, number of columns, gutter and outer margin, and the calculator gives you the exact column width, the content width, and the width of common spans such as 3, 4 or 6 columns, so components snap to the grid in design files and in code. Start from presets for desktop (1440px, 12 columns), laptop, tablet (8 columns) and mobile (4 columns). With a 4-pt or 8-pt baseline selected, it tells you whether columns land on the baseline and suggests the nearest container width that makes them land exactly, and it warns when a gutter or margin is off-grid. A small snapping tool rounds any value to the nearest, lower or higher multiple of your unit. A scaled preview shows the columns, and the code tabs give you a CSS grid rule, CSS custom properties, or a Tailwind snippet with the same values. Everything is calculated instantly in your browser.

Built and maintained by Abhi JainUpdated

How to Calculate a Column Grid

  1. 1

    Choose a preset or enter values

    Pick Desktop, Laptop, Tablet or Mobile, or enter container width, columns, gutter and outer margin.

  2. 2

    Pick a baseline

    Choose the 4-pt or 8-pt baseline unit to check that values stay on the grid.

  3. 3

    Read the results

    See the column width, content width and span widths, and follow the suggestion if columns are off-grid.

  4. 4

    Copy the code

    Copy the CSS grid rule, CSS variables or Tailwind snippet.

Grid Calculator: questions and answers

How do you calculate column width?

Column width = (container − 2 × margin − (columns − 1) × gutter) ÷ columns. A 1440px container with 72px margins, 12 columns and 24px gutters gives (1440 − 144 − 264) ÷ 12 = 86px columns.

Why use a 12-column grid?

Twelve divides evenly into halves, thirds, quarters and sixths, so most layouts fit without awkward spans. Tablets commonly use 8 columns and phones 4.

Do columns need to be a multiple of 8?

Not strictly. Gutters, margins and component spacing matter most. Whole-pixel columns avoid blurry edges, and the calculator suggests a container width that makes columns land on your baseline if you want that precision.

How do I build this grid in CSS?

Use display: grid with grid-template-columns: repeat(12, minmax(0, 1fr)), set column-gap to the gutter and padding-inline to the margin, as in the CSS output. Children span columns with grid-column: span n.