Tools

Home
JSON FormatterSQL FormatterJS ValidatorMinify CSS
Merge PDFCompress PDFImage to PDF
JPG to PNGPNG to WebPCrop Image

Tailwind CSS Grid Generator

Visually build CSS Grid layouts and get ready-to-use Tailwind classes and HTML code

Your files never leave your browser
Items: 3
3
3
Responsive:
Editing: Item 1
Live Previewgrid grid-cols-3 gap-4

Pick columns, rows, gaps, and item spans from the visual controls above — the matching Tailwind classes generate as you go. No more flipping between docs and your editor to figure out if it's grid-cols-3 or col-span-2. And everything runs in your browser. Nothing gets uploaded.

How It Works

Set Columns & Rows
→
Configure Items & Spans
→
Copy Tailwind Code

You configure the grid container (columns, rows, gap) and then customize each child item's span and position. The tool maps every setting to the correct Tailwind utility class — grid-cols-3, gap-4, col-span-2, and so on. Switch between breakpoint tabs to add responsive prefixes like md: or lg: automatically.

Examples

Three-Column Blog Card Layout

A simple equal-width card grid for a blog listing page.

INPUT
Columns: 3 Gap: 4 Items: 3 (all default spans)
OUTPUT
grid grid-cols-3 gap-4

Dashboard with Featured Widget

A 4-column grid where one widget spans 2 columns and 2 rows — typical for analytics dashboards where the main chart needs more room.

INPUT
Columns: 4, Gap: 6 Item 1: col-span 2, row-span 2 Items 2-5: default spans
OUTPUT
Container: grid grid-cols-4 gap-6 Item 1: col-span-2 row-span-2 Items 2-5: (no extra classes)

Responsive Portfolio Grid

Single column on phones, 2 columns on tablets, 4 columns on desktop. This is the pattern you'll use most often for image galleries or portfolio pages.

INPUT
Base: 1 col sm: 2 cols lg: 4 cols Gap: 4
OUTPUT
grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4

Who Uses This

👨‍💻 Frontend Developers

Prototyping grid layouts before committing to code — saves the trial-and-error CSS loop.

🎨 Designers

Checking if a design actually works in a real CSS Grid before handing off to the dev team.

📚 Students

Learning how Tailwind grid classes map to actual layout behavior — seeing results beats reading docs.

⚡ Freelancers

Shipping client landing pages faster by generating the grid skeleton in seconds instead of writing it from scratch.

Common Mistakes

Forgetting to add the grid class

You set grid-cols-3 and gap-4 but nothing happens. The parent needs the base grid class first — without it, the column and gap utilities are ignored. This generator always includes it.

Setting col-span larger than the column count

If you have a 3-column grid and an item with col-span-4, it breaks out of the grid or wraps weirdly. Always keep spans within your column count.

Mixing up responsive breakpoints

Tailwind breakpoints are mobile-first. md:grid-cols-3 means three columns at medium screens and up — not below medium. If your mobile layout looks wrong, check your base (unprefixed) column count.

Technical Details

Frequently Asked Questions

What is the Tailwind CSS grid system?

Tailwind's grid system is a set of utility classes that map directly to CSS Grid properties. You add grid to a container, then use classes like grid-cols-3 and gap-4 to define the layout. No custom CSS needed — it all stays in your HTML markup.

How do I make a Tailwind grid responsive?

Prefix your grid classes with breakpoint names. Something like grid-cols-1 md:grid-cols-2 xl:grid-cols-4 gives you one column on mobile, two at 768px, and four at 1280px. Tailwind is mobile-first, so unprefixed classes apply to all sizes.

What is the difference between col-span and col-start in Tailwind?

col-span-2 makes an item take up two columns wherever it lands. col-start-3 forces it to start at a specific column position. You can combine them — col-start-2 col-span-3 pins the item to column 2 and stretches it across three columns.

Can I control row and column gaps separately?

Yes. Use gap-x-4 for horizontal spacing and gap-y-8 for vertical. This tool generates a single gap value for simplicity, but you can split it in your code after copying.

Do I need Tailwind installed to use the generated code?

You do. The output is Tailwind utility classes, not raw CSS. Add Tailwind to your project via the CDN script tag, npm, or the CLI. The classes work with both Tailwind v3 and v4.

Share:
\n\n\n' + text + '\n\n\n'; var blob = new Blob([fullHTML], { type: 'text/html' }); var url = URL.createObjectURL(blob); var a = document.createElement('a'); a.href = url; a.download = 'tailwind-grid.html'; a.click(); URL.revokeObjectURL(url); } function doReset() { gridConfig = { base: { cols: 3 }, sm: { cols: null }, md: { cols: null }, lg: { cols: null }, xl: { cols: null } }; gridRows = 3; gridGap = '4'; containerClass = 'max-w-7xl'; selectedItemIndex = -1; nextItemId = 4; gridItems = [ { id: 1, colSpan: 1, rowSpan: 1, colStart: 'auto', rowStart: 'auto', label: 'Item 1' }, { id: 2, colSpan: 1, rowSpan: 1, colStart: 'auto', rowStart: 'auto', label: 'Item 2' }, { id: 3, colSpan: 1, rowSpan: 1, colStart: 'auto', rowStart: 'auto', label: 'Item 3' } ]; colsRange.value = 3; colsVal.textContent = '3'; rowsRange.value = 3; rowsVal.textContent = '3'; gapSelect.value = '4'; containerSelect.value = 'max-w-7xl'; itemEditor.classList.remove('visible'); setBreakpoint('base'); renderAll(); } document.getElementById('addItemBtn').addEventListener('click', addItem); document.getElementById('copyTailwindBtn').addEventListener('click', doCopyTailwind); document.getElementById('copyOutputBtn').addEventListener('click', doCopy); document.getElementById('downloadBtn').addEventListener('click', doDownload); document.getElementById('resetBtn').addEventListener('click', doReset); renderAll();