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
- Enter the container width, column count, gutter width and outer margin.
- Get the column width and a table of every span (2 columns, 3…) in px and %.
- If the column has decimals, pick a container width from the suggestions.
- 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
Golden Ratio CalculatorSplit any length by the golden ratio 1.618, scale it up or down, get a golden size sequence and a main/sidebar layout split for your page with ready CSS and a diagram.CSS Units ConverterConvert between px, rem, em, %, vw, vh, pt, cm and more using your root font size and viewport, with a px-to-rem table and vw values on common screens.CSS clamp() GeneratorEnter the smallest and largest size and the two screen widths to get a ready CSS clamp() for fluid type or spacing, with a value table and a full fluid type scale.Aspect Ratio & Resolution CalculatorFind the ratio of any size (1920×1080 = 16:9), fill in the missing width or height when resizing, work out megapixels, compare standard resolutions and fit an image in a frame.