Drag the sliders to set columns, rows, and gaps - the preview grid and the CSS Grid declaration update live below, no upload, nothing leaves your browser.
- Set Columns and Rows to shape the grid track count.
- Set Column gap and Row gap to control the spacing between cells.
- Watch the preview grid update instantly on the right.
- Copy the generated CSS block straight into your stylesheet.
CSS Grid Layout Generator
Set columns, rows, column gap, and row gap with the sliders above and a ready-to-paste `display: grid` CSS block appears immediately, with a live preview grid so you can see the layout before you copy anything.
What the controls do
- Columns slider - range 1 to 12, default 4 - sets the number of grid columns.
- Rows slider - range 1 to 6, default 3 - sets the number of grid rows.
- Column gap and row gap sliders - range 0px to 50px, default 10px each - set the spacing between tracks.
- Live preview grid - the cell count, column and row track counts, and gaps redraw on every slider change using colored placeholder cells.
- Copy button - copies the generated CSS block to your clipboard, with a manual-copy fallback message if the browser blocks clipboard access.
The generator renders with working defaults (4 columns, 3 rows, 10px gaps) as soon as the page loads, so you always see a valid grid and CSS block, even before touching a slider.
Everything runs in this browser tab - no file upload, no account, and no value you enter is sent to a server.
Frequently Asked Questions
What does the CSS Grid Layout Generator do?
It builds a `display: grid` CSS block from four sliders - Columns, Rows, Column gap, and Row gap - and shows a live preview grid alongside the generated CSS text.
Does it support named grid areas or unequal column widths?
No. Every column and row is an equal `1fr` track; named grid areas and custom track sizing need to be added by hand after you copy the generated CSS.
Does anything I enter leave my browser?
No. The generator runs entirely client-side - the slider values never reach a server, and nothing is stored beyond the current page session.