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.
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.
-
Define the grid
Move the sliders to set the number of columns, the number of rows and the gap.
-
Generate the CSS
Watch the preview change, then copy the CSS beneath it.
-
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.
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.
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
Popular Tools
CSS Variable Architect
An interactive CSS Variable Architect, free to run in the browser. The companion guide sets out the method behind it, so you can check the working.
Tools / CSS Variable Architect
True-Contrast Smart Palette
An interactive True-Contrast Smart Palette, free to run in the browser. The companion guide sets out the method behind it, so you can check the working.
Tools / True-Contrast Smart Palette
CSS Unit Converter (px / rem / em / vw / vh)
An interactive CSS Unit Converter (px / rem / em / vw / vh), free to run in the browser. The companion guide sets out the method behind it, so you can check the working.
Tools / CSS Unit Converter (px / rem / em / vw / vh)
Aspect Ratio Calculator
An interactive Aspect Ratio Calculator, free to run in the browser. The companion guide sets out the method behind it, so you can check the working.
Tools / Aspect Ratio Calculator
CSS Grid Architect
An interactive CSS Grid Architect, free to run in the browser. The companion guide sets out the method behind it, so you can check the working.
Tools / CSS Grid Architect
CSS Specificity Calculator
An interactive CSS Specificity Calculator, free to run in the browser. The companion guide sets out the method behind it, so you can check the working.
Tools / CSS Specificity Calculator