Developer Layout Utility

CSS Grid Generator

Test columns, rows, gap, minmax, auto-fit, and alignment options in real time, then generate CSS Grid code instantly.

Generate Grid Layouts Quickly create card-style Grid layouts by adjusting columns, rows, gap, and minmax values.
Live Preview Instantly preview Grid placement, spacing, item height, and alignment as settings change.
Copy CSS Code Copy generated grid-template, gap, align-items, and justify-items code or save it as a CSS file.

Grid Settings

Set the columns, rows, spacing, alignment, and item count for your Grid container.

Quick Presets Apply frequently used Grid patterns instantly.

Choose between a regular repeat layout, responsive auto-fit layout, or custom template mode.

1 3 8
1 2 6
2 6 24
0px 18px 60px
0px 18px 60px
120px 220px 360px

Used in auto-fit minmax mode.

80px 120px 220px
0px 24px 60px
0px 20px 40px

Used in custom template mode. Examples: 240px 1fr 1fr, minmax(180px, 1fr) 2fr

Live Preview
Mode repeat
Columns 3
Gap 18px / 18px

Generated Result

CSS code based on the current Grid settings.

Ready
Change the Grid settings, then click the Generate CSS Code button.

Grid Usage Comparison

Choose repeat, auto-fit, or custom template depending on your layout goal.

repeat columns

Repeat Columns

auto-fit minmax

Repeat Columns

custom template

Repeat Columns

Help

What is a CSS Grid Generator?

A CSS Grid Generator is a developer utility that lets you experiment with Grid layouts in real time and automatically generate grid-template-columns, gap, minmax, and auto-fit CSS code.

It can be used for card lists, image galleries, admin dashboards, utility lists, blog lists, and landing page section layouts.

Features

  • Generate fixed-column Grid layouts based on repeat
  • Generate responsive Grid layouts based on auto-fit minmax
  • Enter custom grid-template-columns manually
  • Adjust column gap, row gap, and item height
  • Set justify-items and align-items alignment
  • Adjust container padding and item radius
  • Preview in real time and copy or download CSS code
What is the difference between repeat and auto-fit?

repeat(3, 1fr) always keeps three columns. repeat(auto-fit, minmax(220px, 1fr)) automatically adjusts the number of columns based on the screen width.

When should I use auto-fit minmax?

It is useful for layouts that should wrap naturally depending on screen size, such as card lists, product lists, and image galleries. It is one of the most common Grid patterns for responsive pages.

When should I use a custom template?

Use a custom template when you need layouts such as 240px 1fr for a sidebar and main content, or 1fr 2fr 1fr for columns with different proportions.

What is the difference between gap and padding?

gap controls the space between Grid items, while padding controls the inner spacing of the Grid container. In card lists, gap is used between cards and padding controls the outer container spacing.

Can I use the generated CSS directly?

The generated code is basic Grid layout code. When applying it to a real project, also check the parent width, responsive breakpoints, and card content length.