Why use CSS Grid Generator?
- Sliders for columns (1–6), rows (1–6), column-gap and row-gap with live pixel readout
- Colour-coded numbered cells make the grid structure immediately clear at a glance
- Preview updates instantly on every slider change — no button press needed
- Copies a clean .container ruleset ready to paste into any stylesheet
About CSS Grid Generator
CSS Grid is the most powerful two-dimensional layout system available in CSS, but writing grid-template-columns and row/column gap values from memory is tedious. The CSS Grid Generator removes that friction: drag the sliders to choose your column count, row count and gaps, then watch the numbered preview cells rearrange instantly. When the layout looks right, copy the generated CSS and paste it directly into your project.
All standard grid container properties are covered — grid-template-columns, grid-template-rows, column-gap and row-gap — giving you a clean, minimal ruleset that works in every modern browser. The tool runs entirely in your browser with no data sent to any server.
How to use CSS Grid Generator
- 1
Set your grid dimensions
Drag the Columns and Rows sliders to choose how many tracks you need. The cell count updates automatically and the preview redraws in real time.
- 2
Adjust the gaps
Use the Column Gap and Row Gap sliders to set spacing between cells in pixels. Zero gap is supported for tight tile layouts.
- 3
Copy and use the CSS
Click the Copy button beside the CSS output to copy the complete .container ruleset, then paste it into your stylesheet and add child selectors as needed.
Frequently asked questions
What does repeat(n, 1fr) mean?
1fr stands for one fraction of the available space. repeat(3, 1fr) creates three equal-width columns that together fill the container. You can manually edit the copied CSS to use fixed px or % values for specific columns.
How do I place items in specific grid cells?
This tool generates the container CSS. To place a child in a specific cell use grid-column and grid-row (e.g. grid-column: 1 / 3) on the individual item in your own stylesheet.
What is the difference between gap, column-gap and row-gap?
gap is a shorthand that sets both column-gap and row-gap at once. This tool outputs them separately so you can see and edit each value independently after copying.
Is CSS Grid supported in all browsers?
CSS Grid has excellent support in all modern browsers — Chrome, Firefox, Safari and Edge. It is safe to use in production for any project not targeting Internet Explorer.
Related color & design
Browse more free tools
Explore every category in our toolbox.