CSS Grid Generator
Visual grid builder β columns, rows, gaps. Copy the CSS.
π 100% private β everything runs in your browser, and nothing is uploaded.
1 Set columns + rows2 Set the gap3 Copy the CSS
The preview draws each row 44px tall so the layout stays easy to read. The CSS you copy uses equal 1fr rows instead, exactly as the hub tool composes it β paste it onto your own container and adjust row sizing in your stylesheet if you need fixed heights.
0:00 Β· Building your gridβ¦
While you wait β tap the star! Score: 0
Free Β· No sign-up Β· Your files never leave your browser
Free, no sign-up β drag the sliders and copy ready-to-paste grid CSS in seconds.
CSS Grid is the layout system built into every modern browser for two-dimensional page design: you declare columns and rows on a container, and the browser places your content into that structure. The starting syntax stops many people cold β one mistyped track list and the whole layout collapses. This CSS Grid Generator removes that first hurdle. You set three numbers with sliders, watch a numbered preview rebuild itself live, and copy a single clean line of CSS to paste onto your own container element.
CSS Grid is the layout system built into every modern browser for two-dimensional page design: you declare columns and rows on a container, and the browser places your content into that structure. The starting syntax stops many people cold β one mistyped track list and the whole layout collapses. This CSS Grid Generator removes that first hurdle. You set three numbers with sliders, watch a numbered preview rebuild itself live, and copy a single clean line of CSS to paste onto your own container element.
Your files never leave your device
No uploads, no queues, no waiting
No account, no card, nothing to install
Who needs a grid generator, and when
Beginners learning CSS meet grid early, usually while building a photo gallery, a card wall or a product listing. Remembering how the repeat function is written is exactly the kind of detail that sends people back to search results again and again. Teachers need a small, predictable example grid to demonstrate the idea without a page of setup code. Working developers use a tool like this as a fast starting skeleton: generate the container rule here, paste it into the stylesheet, then hand-write the item-level rules the design needs. If your layout is a regular grid of equal cells, this is the quickest route from idea to working code.
How to use the CSS Grid Generator
- Set the columns. Drag the Columns slider between 1 and 6. The number beside the label updates as you drag, and the preview gains or loses a column instantly.
- Set the rows. Drag the Rows slider between 1 and 5. The preview fills with numbered cells β columns times rows in total.
- Set the gap. Drag the Gap slider between 0 and 40 pixels. The preview spacing and the gap value in the CSS line change together.
- Copy the CSS. Click Copy CSS. The button label briefly shows a copied confirmation, and the full container rule is on your clipboard, ready to paste.
Exactly what the tool generates
The output is one line with four declarations, always in the same order: display, grid-template-columns, grid-template-rows, and gap. Both track lists use repeat notation with equal flexible tracks. At the defaults β 3 columns, 2 rows, 10 pixel gap β the line reads exactly: display:grid;grid-template-columns:repeat(3, 1fr);grid-template-rows:repeat(2, 1fr);gap:10px;
In plain terms, repeat(3, 1fr) means three columns that share the available width equally, and repeat(2, 1fr) means two rows that share the available height equally. The tool never expands the tracks into a long list and never mixes fixed pixel tracks into the copied code: every track in the output is 1fr. The single gap value applies to both row gaps and column gaps, because the CSS uses the one-value gap shorthand.
One detail deserves attention: the preview and the copied code size rows differently, on purpose in the original design. In the preview, each row is drawn at a fixed height of 44 pixels so the grid stays compact while you experiment. In the CSS you copy, rows are 1fr, so on your own page they stretch to share the height of your container instead. Columns match in both places: 1fr in the preview and 1fr in the output.
Honest limits: fixed ranges, equal tracks, nothing more
This is a deliberately small tool, and its limits are fixed in the code: at most 6 columns, at most 5 rows, and a gap of at most 40 pixels, with a minimum gap of 0. There are no number boxes to type larger values into, so a 12-column framework grid is outside what this generator produces.
Every track is equal. There is no way to make one column wider than another, no per-track editor, no minmax, no auto-fit or auto-fill, and no named grid areas. The cell count is equally fixed: the preview always shows exactly columns times rows numbered cells, and the generator does not place, span or align individual items β placement rules such as grid-column are yours to write by hand after pasting. Container alignment properties such as justify-content are not included either.
What you get is the container skeleton only: one predictable line, three choices, no hidden extras. For regular galleries, card grids and starter layouts that is usually the part people get stuck on.
Frequently asked questions
Is this CSS grid generator really free?
Yes. Move the sliders and copy the CSS β no payment, no account, no watermark and no limit on how many grids you generate.
How do I use the tool?
Drag the Columns, Rows and Gap sliders and watch the preview and the CSS line update live as you drag. When the layout looks right, click Copy CSS and paste the line into the rule for your container element.
What CSS does the tool generate?
One line with four declarations: display:grid, grid-template-columns and grid-template-rows written with repeat notation and equal 1fr tracks, and a single gap value in pixels. At the defaults it reads display:grid;grid-template-columns:repeat(3, 1fr);grid-template-rows:repeat(2, 1fr);gap:10px;
Why do the preview rows look shorter than the copied CSS suggests?
The preview draws each row at a fixed 44 pixels tall so the grid stays compact on screen. The copied CSS uses 1fr rows instead, so on your page the rows share the height of your container. The numbers of columns, rows and the gap are identical in both.
Can I give each column or row its own size?
No. Every column and every row is an equal 1fr track, and there is no per-track editor, minmax or named-area support. If you need uneven tracks, generate the basic grid here and then edit the track list by hand in your stylesheet.
What are the largest and smallest grids I can make?
Columns run from 1 to 6, rows from 1 to 5 and the gap from 0 to 40 pixels. The biggest preview is therefore 6 by 5, which is 30 numbered cells, and the smallest is a single cell with no gap.
Related tools
- Design & Creator Tools β the full design and creator toolbox on one page, including this CSS Grid Generator.
- Free Tools β every free VeloSpark Digital tool in one place.
Built by Umar Hayat β VeloSpark Digital
More Design & Creator Tools
- Design & Creator Tools β the full design & creator toolbox on one page.
- Free Tools β every free VeloSpark tool, guide and category in one place.
