Code · Made a little simpler

CSS Grid Generator

Generate CSS Grid rows, columns, line gaps, alignment and named areas. Test fixed or responsive track sizing and copy matching CSS and HTML.

Free to useNo account neededProcessed on your device
Your workspaceProcessed on your device
Grid tracks and alignment
Grid items and areas

Leave areas blank for automatic items. For named areas, enter one line per row and one name or dot per column.

Live CSS grid
Item 1
Item 2
Item 3
Item 4
Item 5
Item 6
Generated output

Add this tool to your website

Paste this code into your page to add the tool and a visible ToolMellow credit link.

HTML embed code
Preview embed

CSS Grid Generator: how to use it

  1. Open Page shell to preview a full-width masthead, a sidebar, main content and a footer.
  2. Set columns, rows and gaps. For named areas, type one row at a time with a name or dot per cell.
  3. Resize the preview and check placement. Export both CSS and HTML to keep item classes and area names paired.

Limits and notes

Up to 12 explicit tracks per axis and 24 automatically placed items. Supports track lengths, fr, auto, min-content, max-content, minmax(), fit-content() and repeat(). Named areas require fixed track counts and rectangular shapes. Processing stays in your browser.

How your privacy works →

CSS Grid Generator: common questions

Can I use auto-fit and minmax() for responsive cards?

Yes. Choose Responsive cards to try repeat(auto-fit, minmax(136px, 1fr)), then change the preview width to see when a column disappears.

Why does a named area produce a rectangle error?

Every cell in one named area must form a single filled rectangle. Rename or move cells that create a notch, gap or second region.

Do rows and columns need the same gap?

Set row and column gaps separately. The generated CSS preserves both values.

Guides