NGINX Config Formatter
Paste an NGINX configuration file to get a cleanly formatted, consistently indented result. Runs entirely in your browser — no upload, no account.
100% client-side · no upload
How to use the NGINX Config Formatter
- Paste your
nginx.confor a server block snippet into the left panel. - Choose your preferred indent size (2 or 4 spaces).
- The formatted output updates automatically on the right.
- Click Copy to copy the result to your clipboard.
- Paste into your config file and run
sudo nginx -tto validate before reloading.
Common use cases
- Readability: Standardise indentation across configs maintained by multiple engineers.
- Code review: Format a config snippet from a PR comment before analysing it.
- Documentation: Produce clean, copy-paste-ready examples for runbooks or wikis.
- Debugging: Collapse a single-line minified config into readable blocks to spot misconfigurations.
Related tools: .htaccess Builder · Dockerfile Linter · GitHub Actions Linter · All DevOps Tools
よくある質問
- Is my NGINX config sent to a server?
- No. Formatting runs entirely in your browser. Your hostnames, upstream addresses, SSL certificate paths, and any other server details never leave your device.
- What does the formatter change?
- The formatter normalises indentation (2 or 4 spaces per level), ensures each directive ends with a semicolon on its own line, and aligns opening braces on the same line as the block name.
- Does it validate the NGINX config syntax?
- The formatter does basic structural validation — it will report mismatched braces. For full syntax validation, run nginx -t on your server or in a Docker container.
- Can I use this for OpenResty or Tengine configs?
- Yes. OpenResty and Tengine follow the same block-based syntax as NGINX. The formatter handles Lua directives inside content_by_lua_block as plain text.
- Why does my formatted config look different from nginx -T output?
- nginx -T dumps the parsed, merged configuration which may reorder or expand include directives. This tool formats the text as-is without include resolution.
- How should I handle include directives?
- Includes are kept as-is during formatting. To format included files, paste each file separately into this tool.
- Does it support the stream {} block for TCP/UDP proxying?
- Yes. The formatter handles stream blocks, mail blocks, and any other top-level NGINX block type using the same indentation rules.
- How do I test the formatted config before deploying?
- After formatting, replace your nginx.conf and run: sudo nginx -t && sudo nginx -s reload. The -t flag validates syntax without reloading the server.