Dev TooloraLocal dev tools

> Config & Secrets

.env Formatter

Clean common dotenv syntax while preserving order, comments and grouping.

Runs locallyWorks offline
Back to results
Input

Source data

Output

Result

Your result will appear here.

Tool guide

About this tool.

  • A dotenv file stores named string values as KEY=value lines. It is configuration text, not a JSON object or executable shell script.
  • Formatting normalizes assignment spacing while preserving names, values, quotes, comments and source order. It does not sort, deduplicate or resolve references.
  • Malformed syntax or duplicate names stop formatting instead of deleting invalid lines.

  • Normalize a development configuration before reviewing its diff.
  • Keep quoted spaces and literal variable references intact.
  • Use Validator for diagnostics and Secret Redactor before preparing a shareable copy.

Paste configuration or select a sample.

Run formatting and review the output before replacing your source.

Use Copy or download formatted.env for the exact normalized text.

Formatting preserves secrets. Do not publish this output without a separate review.

  • export PORT = 3000 → export PORT=3000.
  • LABEL=" demo " → LABEL=" demo ", with its quoted spaces kept.
  • URL = ${BASE_URL}/v1 → URL=${BASE_URL}/v1, a literal reference.
  • EMPTY = with no value → EMPTY=, an empty string.
  • PORT=3000# note → PORT=3000 # note.
  • PORT=3000 then PORT=4000 → an error naming the duplicate; no last-value-wins rewrite.

  • This parser supports single-line KEY=value assignments, quotes, comments and optional export. Multiline values and shell execution are unsupported.
  • Names must begin with an ASCII letter or underscore and contain only ASCII letters, digits and underscores. Names are case-sensitive.
  • Unquoted # starts a comment, even without a space. Quote literal hashes such as URL fragments.
  • Variable references such as ${BASE_URL} remain literal; no environment lookup, interpolation or escape decoding occurs.
  • CRLF and CR become LF; an initial BOM is removed. Order, grouping and terminal newline are retained unless comments are explicitly removed.
  • Input is limited to 1,048,576 UTF-16 characters. Duplicate names are reported as issues, not silently overridden.
  • Formatter is not a redactor: secrets remain in the output, clipboard and downloaded file.

FAQ

Questions about .env Formatter

Does the formatter sort variables alphabetically?

No. Variables, comments and blank lines keep their original order and grouping. Only whitespace around names, = signs and inline comments is normalized, and an export prefix is kept.

Why did the part of my URL after # turn into a comment?

An unquoted # starts a comment, even without a space before it, so URL=https://example.com/#top becomes URL=https://example.com/ # top. sh and python-dotenv read that value differently, so the summary warns about each such #. Wrap the value in quotes to keep a literal #.

Are ${VAR} references expanded?

No. References such as ${BASE_URL}, backslash escapes and shell syntax are written back exactly as typed; nothing is looked up or executed.

Does it support multiline values?

No. Each assignment must fit on one line. A quoted value that continues onto the next line is reported as an unterminated quote, and nothing is formatted until it is fixed.

Is it safe to format a .env file that contains real secrets?

Formatting runs locally without sending the file anywhere, but the output keeps every value, including secrets. Run Secret Redactor on the result before sharing it.

Continue with

.env ValidatorCheck dotenv syntax, duplicate names and common assignment mistakes.Secret RedactorMask sensitive dotenv values before sharing configuration files.JSON FormatFormat, minify or validate JSON without rounding numbers, rewriting strings or dropping duplicate keys.