Skip to content

Menu

Grid Template Generator

Generate CSS Grid layouts visually

Runs entirely in your browserFrontendFree, no sign-up
Loading tool

01What is Grid Template Generator?

CSS Grid is easy to read once it's written and surprisingly hard to picture while you're writing it. This generator gives you four inputs and a live preview so you can see the layout before it goes into your stylesheet. You type track sizes into Columns and Rows, set a Gap, and optionally sketch named Grid Areas with one row of the grid per line. The inputs are plain text and go straight into the preview's inline style, so anything the CSS Grid Layout spec accepts will work. That includes fr units, minmax(), repeat(auto-fill, ...) and fixed pixel tracks. With areas filled in, the preview makes one labelled cell for each unique area name and places it with grid-area. A dot counts as an empty cell, as the spec defines. Without areas, you get numbered placeholder cells instead. The CSS panel writes a .grid-container rule. It always has display: grid and your columns. It adds grid-template-rows unless the field is empty or exactly auto, adds gap unless the field is empty or exactly 0, and turns each areas line into a quoted string. Next to it, the Tailwind panel builds a class string. If every column is 1fr and there are twelve or fewer, you get grid-cols-N. Otherwise it writes an arbitrary value with spaces swapped for underscores, like grid-cols-[200px_1fr_200px]. The gap class lands on Tailwind's spacing scale only when the value matches a real step, at four pixels per step. So 10px becomes gap-2.5, 1.25rem becomes gap-5, and an odd value like 18px stays as gap-[18px]. Here's the holy grail example from the presets. Columns 200px 1fr 200px, rows 60px 1fr 50px, gap 0, and three area lines for header, sidebar, content, aside and footer. The CSS keeps the columns, rows and all three quoted area rows, and drops the gap. Tailwind gives grid grid-cols-[200px_1fr_200px] and nothing for the gap. Now the limits. The tool doesn't validate your areas, so a non-rectangular area or rows with different cell counts will just make the preview look wrong. The Tailwind string covers columns and gap only. Rows and areas aren't converted. The rows check is a literal match on "auto", so "auto auto auto" still gets written out even though it behaves like the default for three implicit rows. A gap typed as 0px is also written to the CSS, while the Tailwind side drops it. Your inputs stay in component state on the page and aren't saved or sent anywhere.

Frontend developers who want to see a CSS Grid layout take shape before pasting it, and get the matching Tailwind classes for columns and gap. The tool runs entirely in your browser, so your data never leaves your device.

02How to use Grid Template Generator

  1. Type track sizes into Columns and Rows, for example 200px 1fr 200px.
  2. Set the Gap, such as 16px or 1rem.
  3. Optionally fill in Grid Areas, one grid row per line, with the same number of names as columns.
  4. Watch the dashed preview to confirm each area lands where you expect.
  5. Click Copy for the CSS, or select the string in the Tailwind panel.

03Worked examples

Input: Columns 1fr 1fr 1fr, Rows auto auto auto, Gap 16px (the default)
Result: .grid-container { display: grid; grid-template-columns: 1fr 1fr 1fr; grid-template-rows: auto auto auto; gap: 16px; } Tailwind: grid grid-cols-3 gap-4
Only a single auto is dropped, so the default "auto auto auto" is still written out.
Input: Columns 200px 1fr 200px, Rows 60px 1fr 50px, Gap 0, areas: header header header sidebar content aside footer footer footer
Result: .grid-container { display: grid; grid-template-columns: 200px 1fr 200px; grid-template-rows: 60px 1fr 50px; grid-template-areas: "header header header" "sidebar content aside" "footer footer footer"; } Tailwind: grid grid-cols-[200px_1fr_200px]
The Holy grail preset. A gap of 0 is left out of both panels.
Input: Columns repeat(auto-fill, minmax(250px, 1fr)), Rows auto, Gap 24px
Result: .grid-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 24px; } Tailwind: grid grid-cols-[repeat(auto-fill,_minmax(250px,_1fr))] gap-6
The Card grid preset. Spaces inside the arbitrary value become underscores.
Input: Columns 1fr 2fr, Rows 80px 1fr 1fr, Gap 16px, areas: nav main nav chart nav table
Result: grid-template-areas: "nav main" "nav chart" "nav table"; Tailwind: grid grid-cols-[1fr_2fr] gap-4
The Dashboard preset, trimmed to the areas block. nav spans all three rows.
Input: Columns 1fr 1fr, Rows auto, Gap 10px
Result: .grid-container { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; } Tailwind: grid grid-cols-2 gap-2.5
10px is step 2.5 on Tailwind's 4px scale, so it gets a scale class instead of an arbitrary one.
Input: Columns 1fr 1fr 1fr 1fr, Rows auto, Gap 1.25rem
Result: Tailwind: grid grid-cols-4 gap-5
rem values are multiplied by 4 to find the step. CSS output keeps gap: 1.25rem.

04Common use cases

  • Sketching a holy grail page with header, sidebar, content, aside and footer areas
  • Building a responsive card list with repeat(auto-fill, minmax(250px, 1fr)) and checking the column count as you resize
  • Laying out an admin dashboard with a nav column spanning three rows beside main, chart and table areas
  • Turning a hand-written CSS Grid layout into Tailwind classes for a Next.js component
  • Checking which Tailwind gap class matches a designer's 20px or 1.25rem spacing
  • Showing a junior developer how grid-template-areas names map to real cells

05Tips

  • Every row in Grid Areas needs the same number of names, and each name must form a rectangle. Break either rule and browsers throw out the whole grid-template-areas declaration.
  • Use a dot for an empty cell. Several dots in a row (...) also count as one empty cell under the spec.
  • The Tailwind panel skips rows and areas. Add grid-rows-[...] and an arbitrary [grid-template-areas:...] property yourself if you need them.
  • auto-fill keeps empty tracks around, while auto-fit collapses them. With only two cards on a wide screen, auto-fit lets them stretch and auto-fill leaves gaps.
  • Leave Rows as a single auto when you don't need fixed rows, so the copied CSS stays short.

06Related concepts

CSS Grid, grid-template-areas, fr unit, minmax(), Tailwind arbitrary values.

Frequently Asked Questions

What is Grid Template Generator?

Grid Template Generator is a free, browser-based developer tool on AIDToolStack. Generate CSS Grid layouts visually It requires no installation or sign-up and works entirely in your browser.

Is Grid Template Generator free to use?

Yes. No sign-up, no fees and no usage cap.

Does Grid Template Generator store my data?

No. It runs in your browser; nothing is uploaded.

Cheat sheet

Reviews and commentsShow

Reviews

Sign in to leave a review.

Loading reviews…

Comments

Sign in to leave a comment.

Loading comments…

What changed in AI dev tools, once a month

Renames, shutdowns, pricing changes and new MCP setups, each with a source.

Subscribe