About the CSS Grid Generator
This free tool builds CSS Grid layouts in your browser with nothing to install. You pick columns, rows, column width mode, row height, gap, and a first-item span. You can choose equal columns, fit-content, or the responsive auto-fit pattern. A live numbered preview updates as you change settings so you see item order. It outputs ready-to-copy CSS for the grid container and numbered items. Developers and designers use it for prototypes, component layout, and teaching grid basics. No data leaves your device; everything runs client-side in the browser. That makes it faster and more private than tools that require uploads or server processing. It is lighter than visual layout editors that draw named areas, so it suits quick tasks. It highlights the common responsive formula repeat(auto-fit, minmax(220px, 1fr)) for card grids.
How to use it
- 1Choose column count and column width mode (equal, fit-content, or auto-fit).
- 2Set row count and numeric row height in pixels or fractions.
- 3Set gap in pixels and enable a first-item span to cover columns.
- 4Preview the live numbered grid and copy the generated CSS.
Worked example
Input: columns 4, column width auto-fit with min 220px, rows 2, row height 150px, gap 16px, first item spans 2 columns. Resulting CSS: .container { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); grid-template-rows: 150px 150px; gap: 16px; } .container > :first-child { grid-column: 1 / span 2; }
How it works
Builds CSS Grid layouts: columns, rows, column width (equal, fit content or responsive auto-fit), row height, gap and a first item spanning several columns, with a numbered live preview and CSS to copyWorks in the browser with nothing to installSource: W3C CSS Grid Layout Module Level 1MDN CSS Grid Layout. Last checked 7 November 2026.
What it is good for
- Quickly get copyable CSS for container and numbered items.
- Runs entirely in your browser with no uploads or installs.
- Supports responsive auto-fit pattern and a first-item column span.
- Produces grid CSS and a numbered preview only; it does not export full HTML templates.
- It does not create per-breakpoint layouts or named template-area painters.
Questions people ask
What exactly does this generator produce?
It outputs CSS for the grid container and basic item placement plus a live numbered preview. You can copy the container rules and the first-item span rule directly into your code.
How do I make a responsive grid without media queries?
Use repeat(auto-fit, minmax(<min>, 1fr)). For example repeat(auto-fit, minmax(220px, 1fr)) keeps items at least 220px wide and reflows them as space changes. This pattern is documented on MDN.
What is the difference between auto-fit and auto-fill?
auto-fill preserves empty tracks while auto-fit collapses them so items stretch to fill space. Use auto-fit when you want items to grow and avoid empty gaps. MDN explains both behaviors.
Can grid items overlap using this tool?
Yes, overlapping is valid CSS Grid behavior when you assign crossing column or row intervals. You can then control stacking with z-index in your stylesheet.
Will the generated CSS work in Internet Explorer 11?
Generated modern CSS uses grid-template-columns, repeat, minmax, and fr units. IE11 has different grid syntax and gaps are not fully supported, so you should not rely on the output for IE11 without manual fallbacks.
Is the code production-ready?
The generator produces correct CSS for the chosen layout, but you must check semantics, HTML order, and accessibility. Treat the output as a starting point and adapt names and structure for production.
Help keep every tool free
FreeToolr stays free because people help it grow. Share a tool you like, tell us what to build next, or support us on Ko-fi.