CSS Grid Generator
Generate CSS Grid layouts with custom columns, rows and gaps, including responsive auto-fit grids, with live preview.
Tool
Was this tool useful?
About this tool
About CSS Grid Generator
Set up grid columns and rows visually and copy clean CSS for galleries, dashboards and page layouts.
How it works
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) creates as many columns as fit, each at least 200 px wide.
Example
3 columns of 1fr with a 16px gap gives three equal columns.
How to use this tool
- Set the number of columns and rows or choose a responsive auto-fit grid.
- Adjust the gaps and track sizes.
- Copy the CSS.
Frequently asked questions
What is fr?
A fraction of the free space. 1fr 2fr makes the second column twice as wide.
auto-fit or auto-fill?
auto-fit stretches items to fill the row; auto-fill keeps empty tracks.
Does the CSS Grid Generator send my data to a server?
No. The CSS Grid Generator runs entirely in your browser using JavaScript, so tokens, code and data you paste stay on your device. You can even use it offline once the page has loaded.