Nginx Config Formatter Online
Beautify or minify Nginx configuration files instantly in your browser.
When an Nginx config formatter is the right tool
Use this page to indent or compact an nginx.conf in the browser. Paste the file, choose Beautify (2- or 4-space) or Minify, and read the live output. It does not start Nginx or check that a directive is valid. For compose YAML, use Docker Compose Formatter.
Use cases
Cleaning up indentation
Load Sample is a small http/server/location example. Beautify re-indents blocks whose opening { is at the end of a line and whose closing } is on its own line.
Making a compact dump
Minify is useful for a shorter look at structure, but it removes comments and can cut quoted text that contains #. Prefer Beautify when comments or hashes in strings matter.
How formatting works
Each non-empty line is trimmed, then indented or joined according to the current depth. Continuation lines of a split log_format are indented at the same depth as neighboring directives, not specially aligned.
events {
worker_connections 1024;
multi_accept on;
}
http {
server {
listen 80;
location / {
try_files $uri $uri/ =404;
}
}
}What this tool does not do
It does not validate directives, preserve blank lines, or run nginx -t. Formatting stays in your browser.
How to use Nginx Config Formatter
- Paste a config, or use Load Sample, and choose Beautify or Minify.
- For Beautify, pick 2- or 4-space indent and read the live output.
- Copy when the result looks right. Clear resets the input.
Frequently asked questions
How does Nginx Config Formatter work?
Beautify or Minify runs in the browser as you type. Beautify trims each line, drops blank lines, and indents by brace depth (2 or 4 spaces). A # comment is ignored when counting braces but is kept on the line. Minify strips # comments, drops blanks, and joins the file into one line with normalized spaces around {, }, and ;. Load Sample pastes a short nginx.conf-style document. This is an indent helper, not nginx -t and not a parser that understands every directive.
Will Minify break a # character inside quotes?
Yes. Comment stripping is a line-based replacement of # through end of line, with no string awareness. A line such as log_format x "# not comment"; can lose everything after the hash. Avoid Minify when hashes appear inside quoted strings.
Does Beautify keep my blank lines and validate the config?
No. Empty lines are removed, so the original vertical spacing is not preserved. Brace matching is only a depth counter: a { in a comment is ignored, but unusual layouts (such as two braces in unusual places) are not validated. There is no check against the Nginx directive list.
Is my nginx.conf uploaded?
No. Formatting runs in your browser. Clear empties the input. A syntax error display exists in the UI, but the current beautify and minify functions do not throw.
Related tools and guides
References
- Nginx configuration syntax is documented in the Nginx beginner’s guide. This page does not invoke the Nginx binary.