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