🔲

CSS Grid Generator

Build CSS grid layouts with a live preview

🧑‍💻 Developer ToolsFreeRuns in your browser

3

2

16px

72px

1
2
3
4
5
6

CSS

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, 72px);
  gap: 16px;
  justify-items: stretch;
  align-items: stretch;
}

minmax(0, 1fr) keeps long content from blowing out a column. Use auto-fit with minmax for responsive grids without media queries.

About the CSS Grid Generator

The CSS Grid Generator writes a grid container rule while you adjust the layout. Set the column and row counts, gap, and alignment, watch the preview, and copy the finished CSS.

A visual grid removes the guesswork from the first draft, but the final layout still needs real content. Test long words, images, and empty states before locking the columns.

  • ✓Live grid preview
  • ✓Adjustable cell height
  • ✓Stretch, start, center, and end alignment

How to use the CSS Grid Generator

  1. 1

    Set columns, rows, and gap.

  2. 2

    Choose justify and align values.

  3. 3

    Copy the generated CSS.

Frequently asked questions

Why use minmax(0, 1fr) instead of 1fr?+

Grid items default to a minimum size based on their content, which can overflow a column. minmax(0, 1fr) lets columns shrink and keeps the layout predictable.

How do I make it responsive?+

Replace the fixed column count with repeat(auto-fit, minmax(240px, 1fr)) so the browser decides how many columns fit.

Save CSS Grid Generator to your favorites, or keep browsing developer tools.

Browse all 35 developer tools →