100% free · Runs 100% in your browser · No signup needed
Honest note: CSS Grid shines for two-dimensional layouts (rows and columns together). For a single row or a single column of items, Flexbox is usually simpler and needs less code.
Try an example: 3-column cards layout
Building a modern page layout used to mean wrestling with floats, clearfixes, and fragile percentage maths. The CSS Grid Generator changes that completely. It gives you a visual builder for CSS Grid, the two-dimensional layout system built into every modern browser, so you can design rows and columns together, preview the result live with numbered cells, and copy clean, ready-to-use CSS plus a matching HTML skeleton. There is nothing to install and no sign-up: open the tool, drag the sliders, and your layout takes shape in front of you.
CSS Grid works by turning an element into a grid container with display: grid. Once that declaration is in place, you define the tracks — the columns and rows — that make up the grid. The most common way to define columns is grid-template-columns: repeat(3, 1fr), which creates three equal columns. The repeat() function saves you from typing the same value three times, and the fr unit, short for fraction, tells the browser to divide up the available space equally. Three columns of 1fr each therefore get exactly one third of the container width each, no matter how wide or narrow the screen is.
Understanding the fr unit properly is the key to using Grid well. Fractional units distribute the free space that remains after any fixed-size tracks have been accounted for. In a sidebar layout written as 250px 1fr, the first column is always exactly 250 pixels wide, and the second column takes everything that is left over. Mix fixed and fractional tracks freely: a layout of 200px 1fr 2fr gives the first column a fixed 200 pixels, then splits the remaining space so the third column is twice as wide as the second. This behaviour is what makes Grid layouts feel fluid without any media-query gymnastics.
The gap property is the other detail beginners most often misunderstand, so it is worth stating plainly: gap: 16px puts 16 pixels of space between the tracks, not around the outside of the grid. There is no extra 16 pixels at the outer edges of the container. That is a genuine improvement over the old margin-based approach, where gutters at the edges had to be cancelled out with negative margins. With Grid, the spacing is exactly where you expect it and nowhere else, which makes aligning a grid with the rest of your page far simpler.
Using the tool is straightforward. Start by choosing how many columns and rows you want with the sliders, from a single column up to a 12-column grid. Set the gap with its own slider until the spacing looks right in the live preview. Then use the justify and align controls to position content inside the cells, both along the row axis and the column axis. Every change updates the preview instantly, and the numbered cells make it easy to see exactly which cell is which. When you are happy, copy the CSS output and paste it into your stylesheet, along with the matching HTML skeleton the tool provides.
If you would rather not start from a blank canvas, the preset gallery covers the layouts people reach for most often. The 2-column blog preset gives you a main content area beside a narrower column, ideal for articles with a sidebar. The 3-column cards preset is the classic card grid used by portfolios, product listings, and blog archives. The sidebar layout preset uses the 250px 1fr pattern for dashboards and documentation sites. And the 12-column grid preset reproduces the flexible twelve-column system popularised by CSS frameworks, letting you span items across multiple columns for headers, heroes, and feature sections.
A 12-column grid deserves a little extra explanation, because it is the most powerful preset in the collection. With twelve equal columns available, you can build almost any arrangement by making items span different numbers of columns: a hero that spans all twelve, two half-width panels that span six each, or a three-two-one arrangement of four, four, and four. The generator handles the track definition for you, so you only need to decide how many columns each item should span in your own markup. It is the same mental model used by professional design systems, without the weight of an entire framework.
Here is the honest labelling this tool owes you. CSS Grid is a two-dimensional layout system, meaning it controls rows and columns at the same time. That power is exactly what you want for a page layout, a photo gallery, or a dashboard. But for a single row of items or a single column of stacked content, Flexbox is the simpler tool, and you should reach for it instead. Using Grid for a one-dimensional job adds complexity you do not need. This site also offers a dedicated Flexbox generator, and choosing the right tool for the shape of your layout is a skill worth building.
There is also good news about browser support. No vendor prefix is needed for CSS Grid in modern browsers: plain display: grid works everywhere current. The only compatibility note worth mentioning concerns the gap property in older versions of Safari, which did not support gap in Grid layouts. If you still need to support those older browsers, add a fallback — for example, margins on grid items — but for the overwhelming majority of projects today, the generated code works as it stands.
Grid layouts shine in real projects of every kind. Bloggers use the 2-column preset for article pages with related-post sidebars. Shop owners build product grids that reflow gracefully from four columns on desktop to one column on a phone. Developers prototype dashboards in minutes, placing charts, tables, and navigation in a precise grid before writing any production code. Students learning CSS find the visual builder far more instructive than reading a specification, because every slider movement shows immediately what the corresponding property does.
When your layout is designed, you will need a fast, reliable place to publish it. FistHost shared hosting starts at just $0.99/month, and every annual plan includes a free domain, so you can take a layout built in this generator, upload it to your own site, and share it with the world the same day. It is an affordable way to move from experimenting with Grid in a browser tab to running a real website of your own.
Grid pairs naturally with the rest of the CSS toolkit. Once your structure is set, tidy the output with the CSS Beautifier, add depth with the Box Shadow Generator, handle one-dimensional rows and navigation bars with the Flexbox Generator, and style your calls to action with the CSS Button Generator. Together they cover the full journey from layout to polished, finished design.
Finally, a practical tip: design mobile-first whenever you can. Start with a single column, then add columns as the screen gets wider, rather than designing a wide desktop grid and trying to squeeze it down. Grid makes this easy, because changing grid-template-columns at a breakpoint is a one-line change. Combined with the fr unit and the gap property, you get layouts that adapt smoothly instead of breaking abruptly, which is exactly what visitors on phones and tablets expect.
Responsive behaviour is where Grid really earns its keep, and it is worth understanding how the pieces fit together at different screen sizes. A grid defined with repeat(3, 1fr) gives three equal columns on a wide screen, but on a narrow phone those same three columns would squeeze every cell uncomfortably thin. The standard solution is a media query that redefines grid-template-columns — for example, switching to a single 1fr column below a certain width, or to two columns on a tablet. Because the gap and alignment rules stay the same, the layout reflows cleanly instead of breaking. You can also let the browser do this work for you with repeat(auto-fit, minmax(250px, 1fr)), which fits as many columns of at least 250 pixels as the container allows and stretches them to fill the row. Try both approaches in the generator's preview by imagining the container at phone, tablet, and desktop widths, and you will quickly develop a feel for which pattern suits each design.
For anyone who wants to grow beyond the basics, the same generator is a safe place to experiment. Try uneven tracks, try spanning items across columns, try aligning content to the start, centre, or end of a cell, and watch the preview respond. And if you are ready to put your work online, remember that FistHost shared hosting starts at just $0.99/month with a free domain on annual plans, giving your new Grid layout a proper home on the web.
No reviews yet. Be the first to review this tool!
Reviews are protected by captcha and moderated before they appear.