CSS Grid Generator
Drag across the grid to place items, size every track (fr / px / % / auto / minmax), and tune gaps — then export the container + item CSS, grid-template-areas, Tailwind classes, HTML, or JSX. Live editable preview with a shareable URL.
About this ToolHow it works, benefits & use casesTap to collapse
The CSS Grid Generator turns a layout you draw into production-ready code. Instead of guessing at grid-template values, you sketch the layout directly on an interactive canvas — drag across empty cells (or use the keyboard) to place items, size each column and row independently with fr, px, %, auto, or minmax(), and tune the row and column gaps with live sliders. The preview updates as you build, so what you see is exactly what your CSS will render. When the layout looks right, export it as line-based CSS, a grid-template-areas map, Tailwind utility classes, ready-to-paste HTML, or JSX. Every layout is captured in a shareable URL, so you can bookmark a design or hand it to a teammate without re-drawing it. Everything runs in your browser — no sign-up, no upload, and your markup never leaves your machine.
How to Use
- 1Set your track structure: use the Columns and Rows steppers to add or remove tracks, then type a size for each track (1fr, 200px, auto, minmax(0, 1fr), and so on).
- 2Place items by dragging across empty cells on the canvas, or with the keyboard — focus a cell, press Enter to anchor, arrow to another cell, and press Enter again to place.
- 3Adjust the row and column gaps with the sliders; keep them linked for an even gutter or unlink to set each axis separately.
- 4Select any placed item from the list to highlight it, or remove items you no longer need.
- 5Pick an output format (CSS, grid-template-areas, Tailwind, HTML, or JSX) and copy, download, or share the generated code.
Key Benefits
- Draw layouts visually instead of trial-and-error editing of grid-template values
- Size every track independently with fr, px, %, auto, or minmax()
- Export to CSS, grid-template-areas, Tailwind classes, HTML, or JSX
- Live preview that matches the generated code exactly
- Fully keyboard-accessible canvas — place items without a mouse
- Shareable URL captures the entire layout for bookmarking or handoff
- Runs entirely in your browser — nothing is uploaded
Common Use Cases
- Prototyping page layouts like holy-grail, dashboards, and sidebars
- Generating grid-template-areas maps for named, readable layouts
- Producing Tailwind grid utilities for component libraries
- Teaching or learning how CSS Grid track sizing and spanning work
- Handing a precise layout spec to another developer via a single link
Layout grid with 3 rows and 3 columns. Use the arrow keys to move between cells. Press Enter to anchor the start of an item, move to another cell, and press Enter again to place it. Press Escape to cancel. Existing items can be selected and removed from the placed items list below.
Drag across empty cells to place an item, or use the keyboard: focus a cell, press Enter to anchor, arrow to another cell, then Enter to place.
Placed items (0)
Drag across the grid on the left to create your first item.
Layout presets
Copy, download, share, or pipe to another tool
.grid {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
grid-template-rows: 1fr 1fr 1fr;
gap: 12px;
}Draw your layout, get the code
Drag across the grid to spawn placed items — exactly like sketching a wireframe. Size each track independently (fr, px, %, auto, minmax()), then export line-based CSS, a grid-template-areas map, Tailwind classes, ready-to-paste HTML, or JSX.
Was this tool helpful?
Share Your Experience
Help others discover this tool!
Related tools
- CSS FormatterFormat and beautify CSS code
- Spacing Scale CalculatorLinear, geometric, Fibonacci or modular spacing scales with a visual ruler preview and utility classes — export CSS, Tailwind v4, SCSS, JSON
- Changelog GeneratorGenerate changelog from Git commit history
- Component Name GeneratorTurn a description into ranked, kind-aware component names with a file scaffold and a name validator (casing, collisions, clarity)
- Heroku Procfile GeneratorBuild a Heroku Procfile and matching app.json — process types, env vars, addons, dyno formation — plus a Procfile parser and audit
- Markdown TOC GeneratorGenerate table of contents for Markdown
Each column and row accepts any valid CSS grid track value: fixed units like 200px, flexible fr units like 1fr, percentages, the auto keyword, and the minmax() function (e.g. minmax(0, 1fr)). Mix them freely across tracks — for example a 200px sidebar next to a 1fr main column.
Yes. The canvas is fully keyboard-accessible: focus a cell with Tab and the arrow keys, press Enter to anchor the start of an item, arrow to the opposite corner, then press Enter again to place it. Placement is announced to screen readers, and items can be selected and removed from the list below the grid.

