CSS Grid Generator
Free CSS Grid generator: live preview, Tailwind & CSS dual output, grid-template-areas visual editor, auto-fill vs auto-fit demo, 7 presets. No signup.
Updated June 2026
<div class="grid grid-cols-3 grid-rows-2 gap-4">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
</div> Click an item in the canvas to edit its column and row spans.
auto-fill creates as many tracks as possible and keeps the empty ones — auto-fit collapses empty tracks so items stretch to fill the row. Drag the slider to see the difference.
grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));How to use this CSS Grid generator
From blank grid to production code in under a minute
1. Pick a preset or set your tracks
Holy Grail, Dashboard, Card Grid and four more — or drag the Columns and Rows sliders to start from scratch.
2. Adjust item spans or named areas
Spans mode: click an item on the canvas to set its col-span/row-span. Areas mode: type names straight into the matrix and watch the layout update live.
3. Copy the code
Grab Tailwind classes, plain CSS, full HTML, or the Responsive tab — mobile-first media queries generated automatically from your setup.
What this CSS grid layout generator does
Dual code output plus a visual editor for named areas
CSS and Tailwind side by side
Something most grid generators don't offer on the same screen — flip between class-based and property-based output instantly.
grid-template-areas editor
Type area names directly into the matrix and the preview rearranges itself in real time — no memorizing the string-map syntax.
Auto-fill vs auto-fit lab
The single most confusing part of CSS Grid, made concrete with a live, draggable demo instead of a paragraph of explanation.
Responsive tab
Generates mobile-first media queries automatically from whatever layout you built — no manual breakpoint writing afterward.
Examples
What a few common setups produce
When you'll reach for this tool
The most common scenarios among people who use it
Page layouts (Holy Grail)
Header, footer, and three columns in between — the preset generates the whole structure in one click.
Admin dashboards
A fixed sidebar plus flexible content areas — named areas keep the CSS readable as the layout grows more complex.
Product or card galleries
auto-fill combined with minmax builds a gallery that reflows from 4 columns down to 1 without writing a single breakpoint.
Tailwind projects
The Tailwind tab outputs grid-cols-*, col-span-*, and arbitrary values ready to paste into React, Vue, or Svelte components.
Common CSS Grid mistakes
Non-rectangular named areas
An L-shaped area silently invalidates the entire grid-template-areas declaration and the browser falls back to automatic placement with no console warning.
Confusing fr with %
1fr is a fraction of the leftover space after fixed tracks and gaps are accounted for; % is a fraction of the total container width — mixing the two with gap causes overflow.
A span larger than the track count
col-span-4 on a 3-column grid doesn't clip — it forces the browser to create an implicit fourth column, which shifts everything after it.
Why use this CSS grid generator
The visual grid-template-areas editor and the auto-fill vs auto-fit lab turn the two parts of CSS Grid that confuse developers most into something you can see and click through instead of memorize.
The Responsive tab writes mobile-first media queries for you the moment you finish arranging a layout — one less manual step between prototyping and shipping.
auto-fill vs. auto-fit
The most common point of confusion in CSS Grid
Frequently asked questions
Both create as many tracks as will fit using repeat(). When the items don't fill the whole row, auto-fill keeps the leftover tracks empty, while auto-fit collapses those empty tracks to zero width and stretches the existing items to fill the space. They behave identically when there are enough items to fill every track.
References
The definitive reference for every Grid property, with browser compatibility notes.
The most widely used visual cheatsheet for container and item properties.
Google's interactive course covering tracks, areas, and auto-placement in depth.
Related Tools
- Color Contrast Checker Design Free color contrast checker — verify WCAG 2.2 AA and AAA compliance instantly. Live preview, color blindness simulation, and accessible color suggestions....
- Color Converter Design Convert colors between HEX, RGB, HSL, and CMYK instantly. Free online color picker with WCAG contrast checker and palette generator.
- Color Palette Generator Design Generate harmonious color palettes from any base color. Choose Analogous, Complementary, Triadic or Tetradic harmony — export as CSS variables or JSON.
- Color Palette from Image Design Extract color palettes from any image — get HEX, RGB, HSL codes and export as CSS variables, Tailwind config, JSON, or PNG. 100% client-side, no upload.
- CSS Box Shadow Generator — Neumorphism, Glassmorphism & Tailwind Design Free CSS box shadow generator with live preview. Build shadows, neumorphism, glassmorphism effects. Export to CSS, Tailwind, or CSS variables. No signup.