UtilityBase logoUtilityBase

Developer Tools

CSS Grid Generator

Build a CSS grid layout visually — columns, rows, and gaps — and copy the CSS.

Updated July 13, 2026

How to use the css grid generator

  1. 1Set the number of columns and rows.
  2. 2Adjust the row and column gaps.
  3. 3For uneven tracks, type a custom column template like 1fr 2fr 1fr.
  4. 4Copy the CSS onto your grid container.

Common uses

  • Laying out a page with a sidebar and main area
  • Building a responsive card or image grid
  • Learning grid-template-columns and the fr unit
  • Prototyping a layout before writing code

Frequently asked questions

What does the fr unit mean?

fr is a 'fraction of the free space' in the grid. 'repeat(3, 1fr)' makes three columns that split the available width equally. '1fr 2fr' makes the second column twice as wide as the first. Unlike percentages, fr accounts for gaps automatically, so columns never overflow.

How do I make uneven or fixed columns?

Use the custom column template field. Enter tracks separated by spaces — '200px 1fr' gives a fixed 200px sidebar and a flexible main column; '1fr 2fr 1fr' gives a wide center column. You can mix px, fr, %, and keywords like auto. The custom template overrides the column slider.

Should I use Grid or Flexbox?

Grid is two-dimensional — it controls rows and columns at once — so it's ideal for page layouts and card grids. Flexbox is one-dimensional, best for a single row or column that wraps. They work well together: Grid for the overall page, Flexbox inside individual cells.

About this tool

The CSS Grid generator builds a two-dimensional grid layout from visual controls. Set the number of columns and rows, adjust the row and column gaps, or drop in a custom column template like '1fr 2fr 1fr' or '200px 1fr' for uneven tracks and fixed sidebars. A live preview shows the grid filling in as you go, and the clean CSS — using repeat() and the fr unit — copies out for your container. For one-dimensional rows or columns, the Flexbox generator is the companion. Everything runs in your browser.

Like most tools on UtilityBase, the css grid generator runs entirely in your browser — nothing you enter is uploaded or stored on a server. It's free to use with no account required. Browse more developer tools here.

Was this tool helpful?

Related tools