CSS grid generator
Set the columns, rows and gap, then drag across the cells to draw each area: the generator writes grid-template-columns, grid-template-rows and grid-template-areas, or Tailwind 4 classes such as grid-cols-4 and col-span-2. Every area is a rectangle, as CSS requires, and the grid can stack to one column on phones. Tracks take fr, px, rem, %, auto and minmax(); eight bento and page layouts get you started.
Drag across cells to draw an area. Keyboard: arrows move, Shift+arrows select, Enter adds, Delete removes.
- 2×2
- 2×1
- 1×1
- 1×1
- 1×1
- 3×1
<div class="grid md:grid-cols-4 md:grid-rows-3 gap-4">
<div class="md:col-span-2 md:row-span-2">hero</div>
<div class="md:col-span-2">b</div>
<div>c</div>
<div>d</div>
<div>e</div>
<div class="md:col-span-3">f</div>
</div>Tailwind CSS 4. Every class here is compiled with Tailwind 4.3 in our tests and checked against the CSS tab.
Bento grid layouts
A bento grid is one grid of tiles in different sizes, named after the compartments of a Japanese lunch box: a large tile for the main point, smaller ones around it. In CSS it is nothing more than spans. Open a layout in the generator to change it, or copy its Tailwind classes from the card.
- Open in the generator
Hero bento
One 2×2 hero tile, small tiles beside it and a wide strip below.
grid md:grid-cols-4 md:grid-rows-3 gap-4 - Open in the generator
Feature bento
Three columns of features, two tall and two wide.
grid md:grid-cols-3 md:grid-rows-3 gap-4 - Open in the generator
Showcase
A large product tile on six columns with five smaller ones.
grid md:grid-cols-6 md:grid-rows-3 gap-4 - Open in the generator
Gallery
A masonry-like photo wall made of column and row spans.
grid sm:grid-cols-4 sm:grid-rows-4 gap-2 - Open in the generator
Dashboard
A fixed sidebar, a header, three stat tiles, a chart and a list.
grid lg:grid-cols-[220px_1fr_1fr_1fr] lg:grid-rows-[64px_auto_1fr] gap-4 - Open in the generator
Holy grail
Header, navigation, content, sidebar and footer.
grid md:grid-cols-[200px_1fr_200px] md:grid-rows-[auto_1fr_auto] gap-4 - Open in the generator
Lead and stack
A lead story at two thirds with three stacked beside it.
grid md:grid-cols-[2fr_1fr] md:grid-rows-3 gap-6 - Open in the generator
Sidebar
A sidebar that never gets narrower than 200px, next to content at three times its share.
grid md:grid-cols-[minmax(200px,1fr)_3fr] md:grid-rows-[auto] gap-8
Make a bento grid responsive
Below a breakpoint, drop the columns and let the tiles stack: a grid without grid-template-columns has one column, and the tiles follow the order of the markup. That is why the generator writes items in reading order, row by row. In Tailwind, put the breakpoint on the grid classes only; gap-4 and the base grid stay unprefixed. Tailwind 4's breakpoints are sm 40rem (640px), md 48rem (768px) and lg 64rem (1024px).
Fixed-height rows (1fr in a grid with a height) can cut off text on a narrow tile. On phones, let rows size to their content, or give tiles a min-height instead.
The hero bento, stacking below md:
<div class="grid md:grid-cols-4 md:grid-rows-3 gap-4">
<div class="md:col-span-2 md:row-span-2">hero</div>
<div class="md:col-span-2">b</div>
<div>c</div>
<div>d</div>
<div>e</div>
<div class="md:col-span-3">f</div>
</div>Want the tiles filled in? Our 20 bento tiles (a chart, a checklist, a before-and-after and more) fit these cells. For whole sections, see the 52 feature blocks and 18 content card blocks, built on shadcn/ui.
CSS grid and Tailwind 4, side by side
What each Tailwind class compiles to with Tailwind CSS 4.3.3, the version the generator's output is tested against. One spacing step is 0.25rem, 4px at the default root size.
| Tailwind 4 | CSS |
|---|---|
grid | display: grid |
grid-cols-4 | grid-template-columns: repeat(4, minmax(0, 1fr)) |
grid-cols-[200px_1fr] | grid-template-columns: 200px 1fr |
grid-rows-3 | grid-template-rows: repeat(3, minmax(0, 1fr)) |
gap-4 | gap: calc(var(--spacing) * 4), 16px |
col-span-2 | grid-column: span 2 / span 2 |
col-start-3 | grid-column-start: 3 |
row-span-2 | grid-row: span 2 / span 2 |
md:grid-cols-4 | the same, inside @media (width >= 48rem) |
| none | grid-template-areas: no built-in utility, so Tailwind output places items by line |
When the drawing matches what the browser's auto-placement would do anyway, the generator leaves out the start classes and writes only spans (col-span-2 row-span-2). When an area sits after an empty cell, it adds col-start-* and row-start-* to every item so nothing moves.
Bento and feature sections, finished
8 of 92 free, no account. All of them in UI Pro.
01Plain tiles
features-01 · Free. Three open photo tiles with a step, a title and two lines each under a centred heading; no card chrome.
Open features-01
02Link cards
content-cards-01 · Free. Four city photo tiles with an inset frame, the city name and a home count; each tile is one link.
Open content-cards-01- 03
All free blocks
Every one with a live preview, filtered to the ones you can use for free first.
See them all
Questions
How do I make a CSS grid?
Put display: grid on the container and give it columns and rows: grid-template-columns: repeat(3, 1fr) makes three equal columns, and gap: 16px puts space between them. Children fill the cells in order. To make one item cover more cells, give it grid-column: span 2 or place it by name with grid-template-areas.
Named areas or line numbers: which should I use?
Named areas (grid-template-areas plus grid-area: header on the item) read like a drawing of the layout and are easy to change in a media query. Line numbers (grid-column: 1 / span 2) need no names and are what Tailwind uses, because Tailwind CSS 4 has no built-in utility for grid-template-areas (an arbitrary property works, but it is not a class). The generator writes both from the same drawing.
Why does Tailwind write grid-cols-4 as minmax(0, 1fr)?
grid-cols-4 compiles to grid-template-columns: repeat(4, minmax(0, 1fr)). A plain 1fr track has a minimum of auto, so a long URL or a wide image can push its column wider than the others. minmax(0, 1fr) lets the column shrink below its content, which keeps the columns equal. The CSS tab writes it the same way, so the two outputs match.
What is the difference between fr, auto and minmax()?
fr is a share of the space that is left after fixed tracks: 2fr 1fr gives the first column two thirds. auto sizes a track to its content. minmax(200px, 1fr) is a share that never gets narrower than 200px. Note that fr rows only share out height when the grid has one; without a set height they grow to fit the content.
Can a grid area be L-shaped?
No. Every name in grid-template-areas must cover a single rectangle of cells, and every row must have the same number of cells; otherwise the browser drops the whole declaration. The generator only draws rectangles, and when you paste a template it tells you which area breaks this rule.
Should I use CSS grid or flexbox?
Grid when you lay things out in two directions at once, rows and columns, as in a bento grid, a dashboard or a page layout. Flexbox for a single row or column whose items size themselves, such as a nav bar or a row of buttons. Many layouts use both: grid for the page, flex inside the tiles.
Is it free?
Yes. No sign-up, and nothing leaves your browser. The link in the address bar holds your grid, so you can share a layout or come back to it.
More free tools
- Markdown table generatorEdit a table like a spreadsheet or paste from Excel, Sheets, CSV, Markdown or HTML. Copy padded GitHub Markdown with alignment and escaped pipes, HTML (plain or Tailwind) or CSV.
- Free icons150 free SVG icons in one style, with the same names as Lucide. Copy the SVG or JSX, or install the npm package for React. MIT licensed.
- Placeholder logos188 free made-up company logos for mockups and client logo rows, as SVG or PNG in any colour. No attribution, no sign-up.
- shadcn theme generatorMake a shadcn/ui theme from a primary colour, a grey, a radius and fonts, see it on real blocks in light and dark, contrast-checked, and install it with npx shadcn add.
UI Pro
Build your next site from finished blocks
Every block, page template and website theme from €199, paid once, with every update and everything we add later. Not ready? The free blocks are open to everyone.
- blocks
- 1401
- page templates
- 55
- website themes
- 29

This card is a UI Pro block: Rooilijn (call-to-action-07).