grid-template-columns is the single most important property in a CSS Grid layout because it defines how many columns exist, how wide each one is, and how they share whatever space remains after the gaps are subtracted. FixTools lets you build that value through a visual interface, mixing fixed pixels, fr units, percentages, minmax() ranges, and repeat() function calls in any combination, and shows you a live preview of the column tracks before you copy the final property value. Whether you need a quick three-column equal split, a fixed sidebar plus flexible main, or a responsive auto-fill grid, the generator writes the exact string you would otherwise have to compose by hand.
Builds grid-template-columns values with mixed unit types
Supports fr, px, %, minmax(), and repeat()
Live column track preview for each value
CSS Tool
All processing happens in your browser — your files are never uploaded to any server.
🚀Open Grid Flexbox Builder100% Free · No account · Works on any device
grid-template-columns defines the number and width of the columns in a CSS Grid container, and it is the foundational property from which every other Grid-related decision flows. Each value in the space-separated list represents one column track, and you can mix unit types freely within a single declaration. The value 200px 1fr 200px creates a three-column layout with 200px fixed sidebars and a flexible centre column that expands to fill the remaining space. Percentage values are relative to the grid container width, not the viewport, which is an important distinction when the container itself is constrained inside a wider page. The fr unit represents a fraction of the free space available after fixed-width columns and gaps are subtracted. Using fr units for all columns, written either as 1fr 1fr 1fr or with the shorthand repeat(3, 1fr), creates equal columns that collectively fill the container at any size.
The fr unit is the key innovation that made CSS Grid genuinely better than any previous layout system at handling flexible proportional columns. In a 1200px container with a 24px gap between three 1fr columns, the browser calculates: 1200px minus 48px of total gap equals 1152px of usable space, divided by three equal fr units equals 384px per column. Change the value to 1fr 2fr 1fr and the centre column receives 576px while the outer columns receive 288px each, because the four total fr shares split the available space in the requested ratio. The repeat() function is shorthand for repeating a track definition, so repeat(4, 1fr) is identical to writing 1fr 1fr 1fr 1fr. The repeat() function also accepts auto-fill and auto-fit as the first argument, which instructs the browser to calculate the column count from container width rather than accepting it as a fixed number.
repeat() combined with auto-fill and minmax() together create inherently responsive grids that require no media queries to adapt column counts across screen sizes. The value repeat(auto-fill, minmax(280px, 1fr)) tells the browser to create as many columns as fit inside the container, where each column must be at least 280px wide and can grow up to an equal share of the remaining space. At 900px container width you get three columns of roughly 280px each, at 600px you get two columns of about 290px each, and at 320px you get a single column that fills the container. The minmax() function defines a size range for a track, with the first argument as the minimum and the second as the maximum. This pattern is the standard approach for card grids, gallery layouts, product listings, and any container where the column count should adapt automatically to available space.
Beyond these core patterns, grid-template-columns also supports named line markers using square brackets, which improve readability for layouts where child elements span specific columns. The value [sidebar-start] 240px [sidebar-end main-start] 1fr [main-end] gives each column boundary a name that can be referenced from grid-column declarations on children. This is how production design systems make their layouts self-documenting: instead of writing grid-column: 2 / 3 and forcing readers to count tracks, you write grid-column: main-start / main-end and the intent is obvious. The generator supports named lines as an optional setting, and the resulting CSS is exactly as fast to parse and render as a numeric version while being dramatically easier to maintain when the layout evolves.
Add columns one at a time using the column controls. Set each column to a fixed width, fr unit, or minmax range. The generator writes the grid-template-columns value and shows a live track preview as you build.
Step-by-step guide to css grid-template-columns generator:
Add your first column
Click Add Column and set the first column to a fixed width such as 240px, an fr value such as 1fr, or a minmax range such as minmax(200px, 1fr) using the unit selector and value input. The preview renders a single track with sample content so you can confirm the size and proportions visually before continuing. Each unit type behaves differently as the container resizes, which is the main reason it helps to see the result before committing.
Add remaining columns
Add each additional column track one at a time and the live preview shows the proportional width of each track as you build up the value. You can mix unit types freely inside the same declaration, so a 240px sidebar can sit beside two flexible 1fr columns and a third 120px utility column without any extra configuration. The generator validates each value as you type and rejects invalid combinations before they reach the output.
Adjust fr ratios if needed
If the column proportions are not quite right after the initial build, change individual fr values to retune the layout. Watch the preview update in real time as you experiment with different ratios, such as switching 1fr 2fr 1fr to 1fr 3fr 1fr to give the centre column more emphasis. Because fr units always sum to one hundred percent of the available space, you do not need to do any arithmetic yourself, just pick the ratio that looks right.
Copy the property value
Click Copy to copy the finished grid-template-columns value and paste it directly into your CSS Grid container rule alongside display: grid and your chosen gap value. The output is a single property line that drops into any stylesheet, framework, or CSS-in-JS solution without modification. Keep the generator tab open for future tweaks, since adjusting one column proportion later is faster than editing the raw string in your editor.
Common situations where this approach makes a real difference:
Fixed sidebar with flexible main content
A developer building an admin panel needs a 280px sidebar containing navigation links and a main content area that fills the rest of the viewport. The generator produces 280px 1fr as the grid-template-columns value, which is the simplest possible expression of that layout. The sidebar is always exactly 280px regardless of viewport size, while the main area fills all remaining width at any viewport size above the layout breakpoint. The same value works for documentation sites, settings pages, and any interface where a persistent navigation rail flanks a flexible primary content region.
Asymmetric three-column editorial layout
A content designer wants a narrow left sidebar, a wide centre column, and a narrow right sidebar in a 2:7:3 ratio for a magazine-style article page. The generator produces 2fr 7fr 3fr as the value, which expresses the design intent directly in the CSS without any pixel arithmetic. At a 1200px container with 32px of total gaps between the three columns, the columns measure approximately 200px, 700px, and 300px. The fr values make the proportional relationships explicit and resilient: if the container width changes, the ratios stay the same and the columns simply scale, which is exactly what an editorial layout needs.
Responsive card grid with auto-fill
A developer generating a responsive grid for a product listing sets the column value to repeat(auto-fill, minmax(260px, 1fr)) in the generator. The output shows the value and a helpful note that the column count will change automatically with container width. At 1080px container width the grid renders four columns of roughly 260px each; at 560px it drops to two columns of about 270px; at 320px it collapses to a single column that fills the full container width. No media query is needed for the column count to adapt, and the grid behaves identically whether the user resizes the browser or rotates a tablet from landscape to portrait orientation.
Dashboard with mixed fixed and flexible columns
A developer builds a data table grid with a 40px checkbox column on the left, a fixed 120px status column on the right, and three flexible content columns in between for displaying name, email, and last activity. The generator produces 40px 1fr 1fr 1fr 120px as the column value. The fixed columns stay constant at their exact pixel widths while the three fr columns share the remaining space equally as the table container resizes between desktop and tablet widths. The result is a table that uses every available pixel without ever distorting the checkbox or status column dimensions.
Use this when you need to build a specific grid-template-columns value, particularly when combining fr units, fixed widths, and repeat() in the same declaration.
Get better results with these expert suggestions:
Set gap before finalising fr column values
The fr unit distributes free space only after gap has been subtracted from the total container width. If you set fr values without a gap, then add a 24px gap later in the process, all fr columns shrink slightly because there is now less free space to share. Set the gap value first in the generator, then adjust column fr values, so the proportions you see in the preview reflect the final layout exactly. This small habit prevents a category of subtle width mismatches that only become visible after the change goes live.
Use named line values for complex grid placements
For grids where child elements span specific columns, add line names to your grid-template-columns value using square brackets, such as [sidebar-start] 280px [sidebar-end main-start] 1fr [main-end]. Named lines make grid-column declarations on child elements human-readable rather than relying on opaque numeric track indices that force readers to count tracks. This is particularly valuable in production design systems where the layout may evolve over time and the original author may not be the person making future changes.
Prefer minmax(0, 1fr) over 1fr for text-heavy grids
The 1fr unit has an implicit minimum size of auto based on the content inside the column, which means a column containing a long unbroken word, a wide table, or a fixed-width image may overflow its track and push other columns out of alignment. Using minmax(0, 1fr) instead of 1fr explicitly sets the minimum to zero, allowing the column to shrink below its content's natural size and enabling text wrapping or overflow handling to work correctly. This is one of the most common Grid debugging fixes in production.
Test auto-fill versus auto-fit at different container widths
auto-fill creates empty column tracks at the end of a row when items do not fill the grid; auto-fit collapses those empty tracks and stretches the filled columns to absorb the freed space. For most card grids, auto-fill is the correct choice because it prevents the last row of cards from stretching to full width when there are fewer cards than the maximum column count, which preserves visual consistency. Use auto-fit only when you specifically want the final partial row to span the container, which is occasionally the right answer for centred hero rows but rarely for product listings.
More use-case guides for the same tool:
Open the full Grid Flexbox Builder — free, no account needed, works on any device.
Open Grid Flexbox Builder →Free · No account needed · Works on any device