Skip to content
gohacks.dev
DevOps

Nginx Config Formatter

Reformat an nginx.conf or server block with consistent indentation, one directive per line and comments kept, and check that every brace is closed.

Free · No sign-up · Your inputs stay in your browser

Input

Format an Nginx config

Output

Formatted

463 characters

One directive per line, blocks indented, comments kept where they were, quoted strings and regexes untouched. It checks the braces balance, not that the directives exist: nginx -t remains the test that matters.

Runs in this browser. Nothing you paste is sent to a server.

Formatting is not validation

Balanced braces and tidy indentation do not mean Nginx will accept the file. nginx -t parses the whole configuration, resolves includes, and reports unknown directives and invalid values with the file and line. Run it after every change, before reloading.

Where messy configs come from

Configs pasted from tutorials, generated by panels or edited over years by several people drift into mixed tabs and spaces and multi-directive lines. A consistent layout makes the next diff readable, which matters more for a file that controls every request than for most code.

Share

Frequently asked questions

How do I check an Nginx config for errors?
sudo nginx -t tests the configuration and reports the first error with its file and line. nginx -T also prints the full resolved configuration with includes expanded.
Does the formatter change what the config does?
No. It only changes whitespace and line breaks. Quoted strings, regexes and comments are left exactly as they were.
Is what I paste sent anywhere?
No. The tool runs entirely in your browser with JavaScript. Nothing you type or paste is sent to our server or stored.

Keep planning

Similar tools