Kharabeesh
On-device ع

Grid Calculator

Work out column width in a layout grid from container width, column count, gutters and margins, with every span in px and %, a grid preview and ready CSS Grid code.

Free, no sign-up Your data stays on your device Works offline after first open

The tool

Loading the tool…

How to use

  1. Enter the container width, column count, gutter width and outer margin.
  2. Get the column width and a table of every span (2 columns, 3…) in px and %.
  3. If the column has decimals, pick a container width from the suggestions.
  4. Copy the fluid or fixed CSS Grid code. You can also work backwards from a column width.

Privacy & how it works

Processes your data in the browser and stores nothing.

  • Engine: lightweight in-page code, no external libraries.
  • Works offline after you open it once.

Frequently asked questions

How is the column width calculated?

Column = (container − both margins − gutters between columns) ÷ number of columns. A 12-column grid has 11 gutters. For 1200, 12 columns and a 24 gutter: (1200 − 264) ÷ 12 = 78.

Why does a whole-number column matter?

Fractions put element edges between pixels, so they can look blurry or differ by a pixel from column to column. For a fixed pixel grid, pick a width that gives a whole number.

Fluid or fixed grid?

Fluid (1fr) stretches with the screen and suits websites best. Fixed is handy for print layouts or when matching a pixel-perfect design file.

Related tools