CSS Grid Generator
Design CSS grid layouts visually with column and row counts, gap control and a live grid preview. Copy clean grid-template CSS ready for your stylesheet.
Grid settings
CSS
.grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: repeat(2, 1fr);
gap: 12px;
}What is the CSS Grid Generator?
The CSS Grid Generator builds a responsive grid container without hand-writing grid-template rules. Set the number of columns and rows, adjust the gap, and see a live grid of cells update instantly.
- Column and row count controls
- repeat() with fr units for fluid tracks
- Adjustable grid gap
- Live grid preview
- Clean, copy-ready grid-template CSS
- 100% client-side and free
How to use the CSS Grid Generator
- 1
Set the number of columns and rows with the sliders.
- 2
Adjust the gap between grid cells.
- 3
Watch the live grid preview update in real time.
- 4
Copy the generated grid CSS and paste it into your project.
About the CSS Grid Generator
The CSS Grid Generator builds a responsive grid container without hand-writing grid-template rules. Set the number of columns and rows, adjust the gap, and see a live grid of cells update instantly. The generated CSS uses repeat() with fractional units so your grid stays fluid.
It is designed for quickly scaffolding page layouts, image galleries and dashboards. Instead of memorizing grid-template-columns syntax, you drag a slider and copy the result — clean, standards-compliant CSS Grid code.
All rendering and code generation happen locally in your browser. Nothing is uploaded and no account is required.
Frequently asked questions
What does the fr unit mean in CSS Grid?
The fr unit represents a fraction of the available space in the grid container. grid-template-columns: repeat(3, 1fr) creates three equal columns that share the space, automatically resizing as the container width changes.
How does repeat() work in grid-template-columns?
repeat(count, size) is shorthand for writing the same track size multiple times. repeat(4, 1fr) is identical to 1fr 1fr 1fr 1fr but far shorter and easier to change when you adjust the column count.
What is the difference between grid gap and margins?
The gap property spaces grid tracks apart without adding space on the outer edges, and it never collapses like margins can. That makes it the cleanest way to create even spacing between grid cells.
How do I make a responsive grid without media queries?
Use repeat(auto-fit, minmax(...)) so columns wrap automatically based on available width. This generator focuses on fixed column counts, but you can swap in auto-fit in the copied CSS for a fully fluid grid.
Does CSS Grid work in all browsers?
Yes. CSS Grid is supported unprefixed in every modern browser and has been for years. The generated code needs no fallbacks for current Chrome, Firefox, Safari and Edge.
Guides for CSS Grid Generator
Related tools
CSS Flexbox Generator
Build flexbox layouts visually with controls for direction, justify-content, align-items, wrap and gap. Live preview of the boxes and copy-ready CSS.
CSS Button Generator
Design CSS buttons with background, text color, padding, radius, font size, border, shadow and a hover color. Live preview and copy-ready CSS including :hover.
CSS Box Shadow Generator
Make CSS box shadows online with offset, blur, spread, color and opacity controls. Stack multiple shadow layers, preview live and copy the box-shadow code.
CSS Border Radius Generator
Design rounded corners visually with per-corner sliders and a live preview box. Copy modern border-radius CSS, including fancy 8-value organic blob shapes.