CSS Grid Generator
Free online css grid generator for developers. Visual CSS grid builder. Fast and private.
display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(2, 1fr); gap: 8px; justify-items: stretch; align-items: stretch;
Embed this tool
Copy and paste the code below into your website to embed this tool for free. An attribution link to The Util Box is required.
<iframe src="https://www.theutilbox.org/embed/grid-generator" width="600" height="500" frameborder="0" style="border: none; max-width: 100%;" title="Free CSS Grid Generator tool from The Util Box"></iframe> <!-- Free tool by The Util Box — https://www.theutilbox.org/tools/grid-generator --> <a href="https://www.theutilbox.org/tools/grid-generator">CSS Grid Generator by The Util Box</a>
Frequently Asked Questions about CSS Grid Generator
CSS Grid Generator — Columns, Rows, Gap and Alignment
This grid generator builds a two-dimensional CSS Grid from four controls and previews it with a numbered cell for every track. Slide columns from 1 to 6 and rows from 1 to 4, set the gap, and choose how items align within their cells. The output is a ready-made rule block.
The generated declaration always uses fractional units:
display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(2, 1fr); gap: 8px; justify-items: stretch; align-items: stretch;
1fr means "one fraction of the free space", so equal tracks share the container
proportionally and the grid is responsive by construction — no media queries needed for a simple card layout.
justify-items or align-items?
Both control how a grid item sits inside its cell, but on different axes: justify-items
works along the inline (horizontal) axis and align-items along the block (vertical)
axis. stretch — the default here — makes items fill the cell, which is why grid
children automatically become equal height. Switch to start,
end or center and each item shrinks to its content
and is positioned within the cell, which is useful for badges and action buttons.
Two things this generator deliberately keeps simple: tracks are always equal, and it does not emit
auto-fit/minmax() for fluid card walls. Those are a
one-line edit to the output if you need them.
Related Layout Generators
- Flexbox Generator — the one-axis alternative, simpler for toolbars and rows.
- Clip Path Generator — non-rectangular shapes for grid cells.
- Border Radius Generator — round the cards in the grid.
- Gradient Generator — fill them.
Runs locally in your browser.