netlify.toml Builder

Generate a Netlify configuration with build settings and redirects

Builds a netlify.toml with a build command, publish directory, environment variables, redirect rules including SPA fallback, custom headers, and a functions directory — valid TOML ready to commit to your repository root.

Where does netlify.toml live?

It belongs at the root of your repository. Netlify reads it during every build and deploy, and settings in the file override what is configured in the Netlify dashboard.

A correct netlify.toml without TOML guesswork

netlify.toml configures how Netlify builds and serves your site: the build command, the publish folder, redirects, headers, and functions. TOML tables and array-of-tables syntax are easy to mistype, and a malformed file silently reverts to defaults. This builder produces valid TOML from plain inputs.

How it works

The file uses TOML tables. A [build] table holds the command and publish directory, with [build.environment] for build-time variables. Redirects use the [[redirects]] array-of-tables form, each with from, to, and status; the order is preserved because Netlify applies the first matching rule. Headers use [[headers]] with a for path pattern and a [headers.values] sub-table of header names and values. A [functions] table sets the directory Netlify deploys as serverless functions. The builder escapes string values and quotes keys where TOML requires it.

Tips and example

For a single-page app, set the publish directory to dist, then add the SPA fallback redirect from = "/*", to = "/index.html", status = 200 as the last rule. Add security headers like X-Frame-Options = "DENY" under a for = "/*" block. Put serverless functions in netlify/functions and set the functions directory accordingly. Commit the file and Netlify applies it on the next deploy.