About the CSS Grid Calculator
Work out grid column widths, gutters and the CSS for a layout of any column count.
Also known as: grid layout calculator, column width calculator, grid gutter, css grid generator.
How to use this calculator
- Enter container width, columns, gap, container padding and the other fields.
- The result updates instantly as you type — press Calculate (or Enter) at any time.
- Review the breakdown shown under the main result.
- Use Copy result or Share to save the answer or send a link with your inputs.
Formula
column = (container − padding − gaps) ÷ columns
Worked example
Using the values pre-filled in the calculator above:
- Container width = 1,200 px
- Columns = 12
- Gap = 24 px
- Container padding = 24 px
- Item spans = 4
the calculator returns:
- Column width: 74 px
- CSS: grid-template-columns: repeat(12, 1fr); gap: 24px;
- Width of a 4-column item: 368 px
- Content width: 1,152 px