⚡
usefultools.dev
▦

CSS Grid Generator

NEW

Build CSS grid layouts with columns, rows, gaps and areas visually and copy the grid CSS.

Runs 100% in your browser — your input is never uploaded or stored on our servers.

Presets:
Columns (3)
Rows (3)
Named areas

Pick an area, then click or drag across the cells to paint it. Each area must form a rectangle.

Live preview
1
2
3
4
5
6
7
8
9
CSS
.container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 12px;
  height: 240px;
}
HTML
<div class="container">
  <div>1</div>
  <div>2</div>
  <div>3</div>
  <div>4</div>
  <div>5</div>
  <div>6</div>
  <div>7</div>
  <div>8</div>
  <div>9</div>
</div>
⚡

Quick Examples

Typical inputs and the results this tool produces.

Equal tracks
3 × 3 gallery preset
grid-template-columns: repeat(3, 1fr); gap: 8px;
Mixed units
Holy grail preset
grid-template-columns: 150px 1fr 150px;
Areas
Sidebar layout preset
grid-template-areas: "header header" "sidebar main";
minmax
Responsive cards preset
grid-template-columns: repeat(3, minmax(80px, 1fr));
📖

Overview

CSS Grid is the two-dimensional layout system of the web: you define rows and columns, then place items into them. Its syntax packs a lot in: track sizes in fr, px, auto or minmax(), gaps between tracks, and grid-template-areas, where you draw the layout as a text diagram of named areas.

This CSS grid generator lets you build that layout visually. Set the size of every column and row, adjust the row and column gap, then add named areas and paint them onto a clickable grid. The live preview is rendered by your browser with real CSS Grid, and the CSS and HTML update as you work. Identical tracks are collapsed into repeat() automatically.

Areas must form rectangles for grid-template-areas to be valid, so the tool checks that and tells you which area to repaint. Start from a preset such as holy grail, sidebar layout, dashboard or gallery, tweak it, and copy the finished code. Everything runs locally in your browser.

Why use this tool?

  • Draw grid-template-areas instead of typing strings
  • Mix fr, px, auto, minmax() and fit-content() tracks
  • Live preview rendered with real CSS Grid
  • Validates track sizes and rectangular areas
  • Copy matching CSS and HTML
⭐

Features

📐

Flexible tracks

Up to 12 columns and 12 rows using fr, px, %, rem, auto, minmax() or fit-content().

🎨

Paint named areas

Add areas such as header and sidebar and click or drag across cells to place them.

↔️

Separate gaps

Independent row and column gaps, emitted as a single gap shorthand when equal.

👁️

Live preview

See the exact layout your browser would render, updated on every change.

⚡

Layout presets

Holy grail, sidebar, dashboard, gallery and responsive card starting points.

📋

CSS and HTML export

Copy tidy code with repeat() for equal tracks and one class per area.

🛠️

How to Use

1

Define the tracks

Set the number of columns and rows and type a size for each, such as 1fr, 200px or minmax(100px, 1fr).

2

Set gaps and height

Choose the row and column gap and the container height.

3

Paint areas (optional)

Add named areas, pick one and click or drag over the cells it should cover.

4

Copy the code

Copy the CSS and HTML and paste them into your project.

🤔

Frequently Asked Questions