CSS & Design

CSS Grid Generator

Visually build CSS Grid layouts with drag-and-drop item placement and instant CSS output.

Columns (3)

Col 11fr
Col 21fr
Col 31fr

Rows (3)

Row 11fr
Row 21fr
Row 31fr

Gaps

16px
16px

Live Preview

Click and drag on cells to place a new item. Select an item to edit its span.

1
2
3
1
2
3
Item 1
Item 2
Item 3
2
3
4

CSS Output

CSS

.container {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 1fr 1fr 1fr;
  gap: 16px;
}

.item-1 {
  grid-column: 1 / 2;
  grid-row: 1 / 2;
}

.item-2 {
  grid-column: 2 / 3;
  grid-row: 1 / 2;
}

.item-3 {
  grid-column: 3 / 4;
  grid-row: 2 / 3;
}


/* Responsive */

@media (max-width: 640px) {
  .container {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }
}

HTML

<div class="container">
  <div class="item-1">Item 1</div>
  <div class="item-2">Item 2</div>
  <div class="item-3">Item 3</div>
</div>

All processing is done in your browser. No data is uploaded anywhere.

☕ Love this tool? Support the developer.

100% free — no ads, no limits. Your support keeps every tool free.

$

Secure payment via Stripe · No account needed

About CSS Grid Generator

OptiPix CSS Grid Generator is an interactive visual editor for building CSS Grid layouts entirely in your browser. Define up to 12 columns and 12 rows with flexible size units — fr, px, auto, or minmax — and control column-gap and row-gap with sliders. Quick column presets like '3 equal', 'Sidebar + main', and '12-column' let you jump straight to common patterns. In Visual Items mode, drag across grid cells to place and span items, then fine-tune each item's grid-column and grid-row start/end values. Switch to Named Areas mode to paint grid-template-areas by clicking and dragging across cells with a typed area name. Container controls expose justify-items, align-items, justify-content, align-content, and grid-auto-flow. Four built-in layout presets — Blog Layout, Gallery Grid, Dashboard, and Magazine — demonstrate real-world grid patterns instantly. The CSS Output panel generates complete, copy-ready CSS including a responsive media query, plus matching HTML structure. Everything runs client-side with no uploads.

How It Works

All grid state — column definitions, row definitions, gaps, items, and area names — is managed in React. The live preview uses matching inline CSS Grid styles so what you see is exactly what the generated code produces. CSS output is derived from the same state, ensuring the code always reflects the preview. Copy buttons write directly to the clipboard.

Use Cases

  • Design blog, dashboard, gallery, and magazine layouts without writing CSS by hand
  • Learn how grid-template-columns, grid-template-rows, and grid-template-areas work visually
  • Prototype complex multi-column layouts and export copy-ready CSS
  • Create named grid areas for semantic, maintainable stylesheets
  • Generate responsive grid CSS with a built-in mobile breakpoint

Frequently Asked Questions

What size units can I use for columns and rows?
Each column and row independently supports fr (fractional), px (fixed pixels), auto, or minmax(min, max). You can mix units freely — for example '250px 1fr' for a sidebar plus flexible main content.
How do I place grid items?
In Visual Items mode, click and drag across cells in the live preview to place a new item spanning those cells. You can also add items with the + Add Item button and edit their grid-column / grid-row start and end values directly.
What is Named Areas mode?
Named Areas mode lets you paint grid-template-areas by typing an area name and clicking or dragging across cells. Each unique name gets a distinct colour. The generated CSS includes the grid-template-areas property automatically.
Does it generate responsive CSS?
Yes. The CSS Output always includes a mobile media query that collapses the grid to a single column at 640px and below.
Is anything sent to a server?
No. The entire tool runs client-side in your browser. No files or data are uploaded anywhere.

Related Tools

All 102 Tools

Image CompressorBackground RemoverVideo CompressorImage UpscalerOCR Text ExtractorFormat ConverterImage ResizerEXIF RemoverFace BlurDepth EstimationQR Code GeneratorWatermark MakerColor Palette ExtractorPhoto FiltersImage to PDFObject DetectionImage ClassifierImage CaptionerAI Image GeneratorMeme GeneratorGIF MakerPhoto Collage MakerImage CropPhoto EffectsImage to SVGColor ChangerNoise RemoverPhoto RestorationColor PickerFavicon GeneratorImage to Base64Image Metadata ViewerImage AnnotatorPassport Photo MakerDocument ScannerASCII Art GeneratorImage ComparisonSprite Sheet GeneratorObject RemoverPanorama MakerWord CounterCase ConverterLorem Ipsum GeneratorUUID GeneratorUnix Timestamp ConverterText DiffURL Encoder / DecoderHTML Entity Encoder / DecoderBase64 Text Encoder / DecoderText to Binary / Hex / OctalHash GeneratorJSON Formatter / ValidatorRandom String GeneratorCSV ↔ JSON ConverterMarkdown EditorUnit ConverterPercentage CalculatorBMI CalculatorAge CalculatorTip CalculatorCSS Gradient GeneratorCSS Box Shadow GeneratorCSS Border Radius GeneratorGlassmorphism GeneratorNeumorphism GeneratorCSS Text Shadow GeneratorFlexbox PlaygroundCSS Grid GeneratorAudio TrimmerAudio ConverterAudio MergerAudio RecorderVideo to Audio ExtractorAudio Speed ChangerAudio Volume BoosterRingtone MakerVocal RemoverText to SpeechSpeech to TextAudio Noise RemoverAudio EqualizerAudio EffectsVideo TrimmerVideo MergerVideo ResizerVideo Speed ChangerVideo RotatorVideo to MP4 ConverterAdd Music to VideoMute VideoVideo LooperReverse VideoVideo ScreenshotAdd Subtitles to VideoVideo WatermarkScreen RecorderWebcam RecorderSlideshow MakerVideo FiltersCron Expression BuilderRegex TesterUnix Timestamp Converter