home/dev/grid

Free Online CSS Grid Generator

Design CSS grid layouts with live preview

grid-template-columns
grid-template-rows
Gap10px
Presets
1Item 1
col-span1
row-span1
2Item 2
col-span1
row-span1
3Item 3
col-span1
row-span1
4Item 4
col-span1
row-span1
5Item 5
col-span1
row-span1
6Item 6
col-span1
row-span1
.grid { display: grid; grid-template-columns: 1fr 1fr 1fr; grid-template-rows: auto; gap: 10px; }

How to Use CSS Grid Generator

  1. 1

    Define grid structure

    Enter grid-template-columns and rows values, or click a preset layout.

  2. 2

    Adjust gap

    Use the slider to set the gap between grid cells.

  3. 3

    Configure items

    Set column-span and row-span for each grid item to create complex layouts.

  4. 4

    Copy CSS

    Click Copy to get the complete CSS Grid code.

Frequently Asked Questions

Is my data safe?
Yes. All processing happens entirely in your browser. Your data never leaves your device and is never uploaded to any server.
What are fr units?
The 'fr' unit represents a fraction of the available space in the grid container. '1fr 2fr' creates two columns where the second is twice as wide as the first.
Can I mix units?
Yes. You can combine fr, px, %, auto, and other CSS units. For example, '250px 1fr' creates a fixed sidebar and a flexible main column.
When should I use Grid vs Flexbox?
Use CSS Grid for two-dimensional layouts (controlling both rows and columns). Use Flexbox for one-dimensional layouts (a single row or column). Grid is ideal for page-level layout, while Flexbox excels at component-level alignment.

Learn more

About CSS Grid Generator

Design CSS Grid layouts visually with this interactive generator. Define grid columns and rows using fr units, pixels, or any CSS value. Configure gap spacing, add grid items with custom column and row spans, and preview the layout in real time. Includes preset layouts like sidebar+main and holy grail. Copy clean CSS code with one click.

Why Use CSS Grid Generator?
  • Visual grid editor lets you see the layout as you build it — no more guessing with grid-template values.
  • Preset layouts (2-col, 3-col, sidebar+main, holy grail) give you instant starting points.
  • Configure per-item column and row spans for complex grid placements.
  • Generates clean CSS that you can copy and use immediately.
Common Use Cases

Page layouts

Build full-page layouts with headers, sidebars, main content, and footers.

Dashboard grids

Create dashboard layouts with widgets of varying sizes spanning multiple rows or columns.

Gallery layouts

Design image gallery grids with featured items spanning multiple cells.

Learning CSS Grid

Experiment with grid-template-columns, grid-template-rows, and span values to learn CSS Grid.