CSS Grid Generator

Set up columns, rows and gaps visually and copy the grid CSS. Runs entirely in your browser.

Columns3
Rows2
Gap12px
1
2
3
4
5
6
CSS
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: repeat(2, 1fr);
gap: 12px;

Processed on your device. This file is never uploaded.

  1. 1Set the number of columns and rows.
  2. 2Adjust the gap between cells.
  3. 3Copy the grid CSS.

Grid layout without the guesswork

CSS Grid is the cleanest way to lay elements out in two dimensions, but the syntax takes a moment to picture. This generator lets you set the columns, rows and gap with sliders and shows the tracks filling in live, so the relationship between the numbers and the layout is obvious.

Copy the container rule

The output is the CSS for the grid container — display, the column and row templates using repeat() and 1fr, and the gap. Paste it onto a wrapper and its children flow into the cells. It all runs on your device with nothing uploaded.

Frequently asked questions