What Is CSS Grid Template Generator?
CSS Grid Template Generator gives you a live preview while you build a CSS Grid layout. Type the column and row tracks, gaps and template areas (or start from one of five presets), see the grid update, then copy the generated CSS.
How to Use This Tool
Type your column and row tracks (px, fr, auto, minmax(), repeat()), set the gap or separate row and column gaps, and type grid-template-areas as quoted row strings. Choose item alignment, watch the preview, then copy the CSS for the container. Everything runs in your browser.
Why Use CSS Grid Template Generator?
CSS Grid is incredibly powerful but its template syntax is hard to visualize mentally, especially for complex layouts with named areas and mixed track sizes. This tool gives you a WYSIWYG grid editor that outputs clean, production-ready CSS. It’s free, requires no account, and beats guessing at column fractions. For a detailed walkthrough, see our step-by-step guide.
Common Use Cases
Bootstrapping a page layout where a hand-drawn sketch needs to become real CSS without typing out grid-template-areas strings line-by-line. Teaching Grid to engineers used to Flexbox — seeing the named-area syntax visually before reading the spec makes the concept click. Building dashboards with header, sidebar, content, and footer regions where the proportions need a few rounds of tweaking before they look right.
Marketing landing pages with magazine-style asymmetric layouts (hero, callout, feature, feature, testimonial) that defy a simple column grid. Email-template scaffolding where the resulting CSS needs to be readable enough that the next person to edit the file can follow it. Converting a Figma frame into the matching Grid declaration by reproducing the columns, rows, and area names from the design.
Worked example: the five presets, checked in a browser
We loaded each preset in Chromium 141, copied the generated CSS and had the browser parse it to see which declarations survive, then counted the preview cells. October 12, 2026 is the old tool; October 13 is after the fix. Every declaration of every preset now survives parsing (the browser folds columns, rows and areas into one grid-template shorthand).
| Preset | Gap line, Oct 12 | Gap line now | Preview cells, Oct 12 | Preview cells now |
|---|---|---|---|---|
| Holy Grail | gap: 0px; valid | gap: 0; valid | 9 | 9 (3 × 3) |
| Dashboard | gap: 16pxpx; invalid | gap: 16px; valid | 9 | 9 (3 × 3) |
| Blog | gap: 24pxpx; invalid | gap: 24px; valid | 6 | 6 (2 × 3) |
| Gallery | gap: 12pxpx; invalid | gap: 12px; valid | 4 for a 3 × 3 grid | 9 (3 × 3) |
| Landing | gap: 0px; valid | gap: 0; valid | 4 | 4 (1 × 4) |
What changed. Three presets stored their gap with a unit already attached and the output added another "px", so the browser threw the gap away. The Gap fields now take a bare number (written as px) or any CSS length such as 1rem or 2%, and anything the browser rejects, in tracks, gaps or areas, is named above the preview. The preview used to count tracks by splitting your text on spaces, so repeat(3, 1fr) counted as 2; it now lays the template out on an empty copy and counts the tracks the browser actually builds.
Rules for grid-template-areas that the tool won't check for you
- Every row needs the same number of cells, and that number should match your columns. A row string with a different count makes the whole
grid-template-areasdeclaration invalid. - Each named area must be a single rectangle. An L-shaped or split area such as
"a a" "a b" "b b"(wherebwraps) also invalidates the whole declaration. Use.for an empty cell. - Children still need placing. The output defines the areas on the container only. Give each child
grid-area: header;(and so on) yourself, matching the names you used.
gap for grid, grid-template-areas and named areas are supported unprefixed in every current browser, according to MDN's compatibility data. No -ms- fallback is needed unless you still support Internet Explorer.
Sources
Checked on .
Frequently Asked Questions
Built by Derek Giordano · Part of Ultimate Design Tools