CSS Grid Auto-Fit & Auto-Fill Generator

The most useful CSS grid pattern — repeat(auto-fit, minmax()). See the live difference between auto-fit and auto-fill, configure the values, copy the CSS.

auto-fit

collapses empty tracks
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));

auto-fill

keeps empty tracks
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));

auto-fit

With fewer items than columns, auto-fit collapses empty tracks to 0 and stretches remaining items to fill the full container width.

Use when you want items to always fill the row, even with few items.

auto-fill

With fewer items than columns, auto-fill keeps empty tracks at their minimum width — items stay at their natural size.

Use when you want a fixed column rhythm regardless of item count.

auto-fit CSS

    
auto-fill CSS

    
📦 CSS Tools + UIFlow Complete Bundle
Every preset pack + all UI components: 368 snippets in one file. One-time, €19.
✓ Matching set, tested together · ✓ Commercial & client projects OK · ✓ Instant download
€19 →
🎁 Not ready to buy? Get 10 free CSS presets →

Related Tools

CSS Grid Generator Grid layouts with template areas — drag cells, copy CSS Flexbox Generator Flexbox layouts — direction, alignment, spacing, individual items CSS Spacing Generator Visual padding and margin builder. Set each side independently, choose CSS Scroll Snap Generator Build scroll snap containers — scroll-snap-type, align, padding. Inter