Skip to content

CSS Grid Generator

Pick columns and rows, set gaps in px/rem/%, optionally customize track templates, click cells to span named areas, and copy parent plus child CSS. Free CSS grid generator online — runs in your browser.

  • Columns and rows from 1–12 with live preview
  • Column/row gap in px, rem, or %
  • Optional custom track templates (fr, px, minmax…)
  • Click start/end cells to assign named spans
  • Copy parent CSS plus child placement examples
  • 100% client-side — nothing uploaded

Generator

Generated locally, nothing uploaded

Click a start cell, then an end cell to span. Visual controls — no drag-and-drop required.

    CSS

    How to generate a CSS Grid layout

    1. 01

      Set columns, rows, and gaps

      Choose how many tracks you need (1–12) and set column/row gap with px, rem, or %.

    2. 02

      Customize templates if needed

      Leave templates blank for equal 1fr tracks, or type values like 200px 1fr 1fr or repeat(auto-fit, minmax(12rem, 1fr)).

    3. 03

      Span named areas on the preview

      Enter an area name, click a start cell, then an end cell to create a grid-column / grid-row span.

    4. 04

      Copy the CSS

      Paste the .parent rules into your stylesheet and map child classes to your HTML. Optionally include a Tailwind sketch comment.

    What this CSS grid generator online is for#

    A CSS grid layout generator online exists so you can see tracks and gaps before you commit markup. Instead of guessing repeat(12, 1fr) or hand-writing line numbers, you dial columns and rows, watch numbered cells update live, and copy a ready .parent { display: grid; … } block. This CSS grid maker online keeps the defaults boring on purpose: equal 1fr tracks and a shared gap, which is the fastest way to sketch a card deck, dashboard, or form layout. When you need asymmetric tracks, the optional column and row template fields accept anything valid in grid-template-columns / grid-template-rows — fixed pixels, fr, minmax(), auto, or repeat(auto-fit, minmax(12rem, 1fr)) for a css grid generator responsive pattern that wraps without media-query soup.

    fr units, gaps, and why grid-gap became gap#

    The fr unit is a flexible fraction of free space after fixed tracks and gaps are accounted for. Two columns of 1fr 1fr split leftover width evenly; 1fr 2fr gives the second column twice the free space. That is usually clearer than percentages when you also have gutters. Speaking of gutters: modern CSS uses gap (or column-gap / row-gap). Older tutorials still say grid-gap — browsers still accept it as a legacy alias, but new code should prefer gap. This tool emits gap when both axes match, and separate column-gap / row-gap when they differ, with units in px, rem, or %. Rem-based gaps scale with root font size; percentage gaps resolve against the grid container’s content box, which is useful inside fluid shells but can surprise you if the parent width is indefinite.

    CSS grid template areas and click-to-span placement#

    Named regions are how many designers think about layout: header, sidebar, main, footer. In CSS that maps to grid-template-areas strings plus grid-area on children — or to explicit line-based placement with grid-column and grid-row. This generator takes the practical path: click a start cell and an end cell to define a named span, then emit both a grid-template-areas matrix (when spans exist) and child classes with line-based placement. Unassigned cells show as . in the areas template, which is valid CSS. You do not need a css grid generator drag and drop workflow; visual start/end selection is enough for most page chrome and keeps the UI keyboard-friendly. Copy the CSS into your HTML by giving matching class names to child elements — paste the parent rules on a wrapper and the child blocks on the pieces that should span.

    Responsive grids and Tailwind (without becoming a Tailwind builder)#

    For a css grid generator responsive setup, prefer fluid track recipes over hard-coded breakpoints when you can: repeat(auto-fit, minmax(14rem, 1fr)) lets columns reflow as the container shrinks. Pair that with modest gaps and avoid mixing too many fixed pixel tracks unless you also plan overflow. If you live in Tailwind, remember this tool outputs plain CSS you can adapt — it is not a Tailwind config builder. An optional sketch comment can suggest grid grid-cols-N for equal tracks or arbitrary-value classes like grid-cols-[200px_1fr_1fr] for custom templates. Treat that as a hint, then refine with responsive prefixes (md:grid-cols-3) in your project. The same copied CSS works equally well in vanilla stylesheets, CSS Modules, or design-system tokens.

    Frequently asked questions

    How do I make a responsive CSS Grid with this generator?

    Use a fluid column template such as repeat(auto-fit, minmax(12rem, 1fr)) instead of a fixed number of 1fr tracks. The preview still helps you reason about gaps; in production the tracks wrap as the container narrows. Add media queries only when the design truly needs a different structure.

    What does the fr unit mean in grid-template-columns?

    fr is a fraction of the free space left after fixed-size tracks and gaps. Equal 1fr tracks share space evenly; 1fr 2fr gives the second track twice as much free space as the first.

    Should I use gap or grid-gap?

    Prefer gap (or column-gap / row-gap). grid-gap is a legacy alias kept for compatibility; new stylesheets should use the standard gap properties, which is what this tool outputs.

    What are CSS grid template areas?

    grid-template-areas lets you draw a named ASCII map of regions (for example "header header" / "nav main"). Children then use grid-area: header. This tool builds that map from the spans you create by clicking start and end cells, and also emits line-based grid-column / grid-row examples.

    Does this CSS grid generator support drag and drop?

    No drag-and-drop — you use visual controls instead: set tracks and gaps with inputs, then click a start cell and an end cell to span a named area. That keeps placement precise without a DnD surface.

    Can I use the output with Tailwind CSS?

    Yes. The primary output is plain CSS you can paste into a global stylesheet or a style block. Optionally enable the Tailwind sketch comment for equal-track or arbitrary-value class ideas — it is a hint, not a full Tailwind config builder.

    How do I copy this into my HTML?

    Copy the CSS block, put the .parent rules on your grid wrapper, and give children the generated class names (or rename them to match your markup). No upload or account is required — everything runs in your browser.

    Is anything uploaded to a server?

    No. The CSS is assembled entirely in your browser — nothing you enter is uploaded.

    Developers

    UUID Generator

    Generate cryptographically random UUID v4 or time-ordered UUID v7, in bulk.

    Developers

    Base64 Encoder & Decoder

    Encode and decode Base64 with correct UTF-8 handling, including the URL-safe alphabet.

    Developers

    ULID Generator

    Generate ULIDs — sortable by creation time like UUID v7, but Crockford Base32 instead of hex.