CSS Grid Columns Generator

Build equal-width grid columns with a configurable gap.

Try an example

Enter an integer column count and a gap in pixels.

3, 16

Expected output

display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 16px;

Common questions

Does it automatically change column count on phones?
The output uses a fixed column count. Add a media or container query when narrow layouts need fewer columns.
What does minmax(0, 1fr) do?
It gives each track an equal share and permits it to shrink below its content’s intrinsic width. Long content may still need wrapping.

The tool processes your input in this browser. It does not upload the input itself.