CSS Grid Named Areas Builder
Paint named areas on a grid and generate valid grid-template-areas CSS in your browser
Grid editor
3 x 3Click a cell to paint it with this name. Type a dot (or leave it empty) to paint an empty cell; right-click or Shift-click also erases.
One size repeats for every track (1fr); or list one per track, e.g. 200px 1fr auto.
Generated CSS
4 named areas.grid-container {
display: grid;
grid-template-areas:
"header header header"
"sidebar main main"
"sidebar footer footer";
grid-template-rows: 1fr 1fr 1fr;
grid-template-columns: 1fr 1fr 1fr;
}
.header { grid-area: header; }
.sidebar { grid-area: sidebar; }
.main { grid-area: main; }
.footer { grid-area: footer; }- header: row 1, column 1-3
- sidebar: row 2-3, column 1
- main: row 2, column 2-3
- footer: row 3, column 2-3
Live preview
Examples
Header over sidebar gap
[["header", "header"], [".", "main"]]templateAreas: '"header header"\n ". main"' + .header / .main grid-area rulesDots stay literal placeholders in quoted rows, and each named area gets exactly one grid-area rule.
Smallest valid grid
[["card"]]valid: true, templateAreas: '"card"', css with 1fr row/column plus .card ruleA 1x1 matrix is the minimum accepted grid and emits a single template row and rule.
About this tool
CSS Grid Named Areas Builder validates a string matrix with validateGridAreas(matrix): it rejects empty or ragged grids (Grid must contain at least one cell.), enforces CSS-identifier area names (Invalid area name ".."), and requires every named area to fill a solid rectangle — any L-shaped or disconnected footprint fails with Area "nav" must form a solid rectangle (L-shaped or disconnected areas are not allowed). "." cells and blank strings are empty placeholders, and areas returns first-seen names in order.
buildGridCss(matrix, rowSize = "1fr", columnSize = "1fr") emits the stylesheet regardless of validity: templateAreas quotes each row ("header header" / ". main", joined with \n plus two-space indent), the container sets display: grid with grid-template-areas, grid-template-rows (one rowSize per row), and grid-template-columns (one columnSize per column), then one .<name> { grid-area: <name>; } rule per area in first-seen order.
The minimum grid is a single cell: [["card"]] validates true with templateAreas '"card"' and one .card rule, and building is deterministic — the same matrix always yields the same templateAreas and css strings.
How to use this tool
Lay out the matrix
Provide rows of area names with "." for empty cells; validateGridAreas reports validity, message, and the ordered area list.
Keep areas rectangular
Fill each name's bounding box completely — L-shaped or split footprints are rejected with the solid-rectangle message.
Copy the CSS
Call buildGridCss(matrix) and paste .grid-container plus the per-area .<name> { grid-area: <name>; } rules into your stylesheet.
Use cases
Prototyping page shells
Sketch header/sidebar/main layouts as a name matrix and copy the grid-template-areas block into CSS.
Catching non-rectangular areas
Validate hand-drawn ASCII layouts and get the exact L-shaped area name to fix before writing CSS.
Teaching grid areas
Show how dots create gutters and how each quoted row maps to one grid-template row track.
Common mistakes
Mistake:Drawing L-shaped or split areas.
Fix:Every name must fill its full bounding rectangle — move the stray cell or rename it so each area is one solid block.
Mistake:Using invalid area names.
Fix:Names must match a CSS identifier (letters, digits, _/-; no leading digit) — rename "1st" to "first" and avoid spaces.
Mistake:Feeding ragged rows.
Fix:Every row needs the same column count; pad short rows with "." so the matrix is a true rectangle.
Frequently asked questions
What does this tool do?
It validates a name matrix with validateGridAreas and emits stylesheets with buildGridCss: quoted grid-template-areas rows, display: grid container with 1fr row/column tracks by default, and one .<name> { grid-area: <name>; } rule per area.
What passes validation, and what fails?
[["card"]] is the minimum valid 1x1 grid; [["header","header"],[".","main"]] keeps dot placeholders as '". main"'; and [["nav","nav"],["nav","."]] fails with Area "nav" must form a solid rectangle (L-shaped or disconnected areas are not allowed).
Is my layout uploaded or stored?
No. Validation and CSS emission are pure client-side string building — grid data never leaves your browser.
What does the CSS output contain?
A .grid-container with grid-template-areas (each row a quoted string), grid-template-rows/columns with one track per row/column, plus exactly one grid-area rule per named area in first-seen order.
Related guides
References & standards
Related tools
.env Secret Safety Linter
Validate .env syntax and spot likely leaked credentials or placeholder secrets.
.gitattributes Generator
Build .gitattributes rules for line endings, Git LFS, GitHub linguist marks and merge drivers — with a one-line explanation for every rule.
.htaccess Generator
Build an Apache .htaccess — HTTPS redirects, rewrites, error pages, security headers, and basic auth
2D Fluid Dynamics & Particle Physics Sandbox
A physics playground with two engines sharing one canvas. The fluid mode runs a real Eulerian Navier-Stokes solver — semi-Lagrangian advection, explicit diffusion, Jacobi pressure projection and vorticity confinement — that you paint with dye and velocity using mouse or touch. The particle mode is a damped Verlet N-body engine with gravity wells, Coulomb attractors and repulsors, spring links, wall restitution and elastic circle collisions. Particle counts adapt to the device (100k target on WebGL2 desktop, 2k-5k on CPU fallback), and every configuration exports as runnable code: a Matter.js world, a PixiJS ticker setup, or a standalone vanilla Canvas engine.
A/B Test Sample Size Calculator
Compute required sample size per variant and test duration from baseline conversion rate, minimum detectable effect, alpha and power.
ABA Routing Number Validator
Validate 9-digit US ABA routing numbers with 3-7-1 Mod-10 breakdown.