Interactive layout tool

Build a CSS grid and get the code as you go

Choose your columns, rows and gap, and the tool writes the CSS as you go, ready to copy. Every column gets an equal share of the space, and so does every row. Edit the sizes in your own stylesheet if you want them to differ.

How-To Guide

What the tool writes for you

The tool makes an even grid of up to six columns and six rows, with a gap of up to 50 pixels. It writes grid-template-columns, grid-template-rows and gap for you to copy. Named areas (grid-template-areas) are for you to add.

Level: Intermediate
Best for: Front-end developers and product designers building responsive layouts
  1. Define the grid

    Move the sliders to set the number of columns, the number of rows and the gap.

  2. Generate the CSS

    Watch the preview change, then copy the CSS beneath it.

  3. Check it against your content

    Put your own content into the grid and check that each cell is large enough. The tool can't see what you will put there.

CSS Grid Architect

Choose the number of columns, rows and the gap between cells. The preview and the generated CSS below always match exactly what you set.

Grid settings

Live preview

Generated CSS

Why fr units instead of percentages?

The fr unit divides up the space that is left over after gaps and any fixed-size tracks have been accounted for. If you used percentages instead, the browser would have to size tracks first and then subtract the gap separately, which can push the total width past 100% and cause overflow or awkward rounding. With fr, the gap is always removed from the available space before the remaining space is shared out, so the columns or rows always fit exactly, no matter how large the gap is.

Free Tools

See your grid before you write a line of CSS

The tool turns your column count, row count and gap into grid-template-columns and grid-template-rows code. Check the result with your own content and in the browsers you support before you use it.

No account needed · works on any device · free to use