CSS Grid Generator

Build CSS grid layouts visually and export the complete code.

3
3
8px
1
2
3
4
5
6
7
8
9
CSS
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 80px 80px 80px;
  gap: 8px;
}

What is the Free CSS Grid Generator?

The free CSS Grid Generator lets you configure a CSS grid layout visually and generates the complete grid-template-columns and grid-template-rows CSS. Set the number of columns and rows, choose column and row sizing (fr, px, auto, min-content, max-content), and control gap values. A live preview shows the grid before you copy the CSS.

  • Build a responsive image gallery grid without remembering grid syntax.
  • Create a dashboard layout with defined column and row tracks.
  • Design a magazine-style article layout using named grid areas.
  • Prototype a pricing table or feature comparison grid layout.
  • Generate a CSS grid for a card layout that switches between 2 and 4 columns.

How to Use the Free CSS Grid Generator

  1. 1 Set the Columns and Rows count fields to define the grid dimensions.
  2. 2 Choose a column size from the dropdown: 1fr, auto, px, min-content, or max-content.
  3. 3 Choose a row size the same way.
  4. 4 Toggle Custom gaps to set independent column-gap and row-gap values, or leave it off for equal gaps.
  5. 5 Watch the live grid preview update, then click Copy CSS to grab the output.

Key Features

  • Configurable grid tracks
    Set column and row counts with fr, auto, px, min-content, or max-content sizing.
  • ↔️
    Custom gap control
    Set column and row gaps independently or use a single gap value.
  • 👁️
    Live grid preview
    Visual preview of the configured grid before copying the CSS.
  • 📋
    Complete CSS output
    Generates the full grid-template-columns, grid-template-rows, and gap declarations.

Example Usage

Example Input
Columns: 3, Rows: 2, Col size: 1fr, Row size: auto, Gap: 16px
Example Output
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: auto auto;
  gap: 16px;
}

Frequently Asked Questions about the Free CSS Grid Generator

What is the free CSS Grid Generator?
Build CSS grid layouts visually and export the complete code.
Is the CSS Grid Generator free to use?
Yes, the CSS Grid Generator is completely free. No account, subscription, or signup is required — ever.
Does my data get uploaded anywhere?
No. The CSS Grid Generator runs entirely in your browser. Your data is never sent to any server.
Does it work offline?
Yes. Once the page has loaded, the tool works without an internet connection.
Which browsers are supported?
All modern browsers — Chrome, Firefox, Safari, and Edge. No plugins or extensions required.
What does "1fr" mean in CSS Grid?
"fr" is a fractional unit. "1fr" means one fraction of the available space. In a three-column grid of "1fr 1fr 1fr", each column takes exactly one-third of the available width.
Can I create a responsive grid without media queries?
Yes — use repeat(auto-fill, minmax(200px, 1fr)) which creates as many columns as fit within the container. This is not directly generated by this tool but can be built from its output as a starting point.

Related Free Generators