.env · transform

ENV Formatter

Format, align, and sort .env files automatically. Enforce naming conventions, remove duplicates, and keep configs clean.

Be the first to rate
API_KEY   =def
DB_URL    =postgres://...
NAME      =has space
PORT      =3000
STRIPE_KEY=sk_test_xxx

What it does

  • Align = signs for readability
  • Sort alphabetically or group by prefix
  • Quote values with spaces or special characters
  • Remove duplicates and empty lines
  • UPPERCASE key normalization

Privacy

Runs 100% in your browser. Your .env never touches our servers.

client-side only

Usage examples

Case 1 · Sort + align
PORT=3000
DATABASE_URL=postgres://...
NODE_ENV=dev
DATABASE_URL = postgres://...
NODE_ENV     = dev
PORT         = 3000
Case 2 · UPPERCASE + dedupe
api_key=abc
API_KEY=def
debug=true
API_KEY=def
DEBUG=true
Case 3 · Group by prefix
DB_URL=postgres://
NEXT_PUBLIC_SITE_URL=...
DB_POOL=10
NEXT_PUBLIC_API_URL=...
# DB
DB_POOL=10
DB_URL=postgres://

# NEXT
NEXT_PUBLIC_API_URL=...
NEXT_PUBLIC_SITE_URL=...

When to use this tool

  • PR comes in with inconsistently-cased .env — normalize before merging
  • Long .env that grew organically and keys are in random order
  • Shared .env.example where alignment + sort order matter
  • Preparing a .env for code review so diffs stay clean
  • Migrating from one dotenv dialect to another

Common mistakes

  • Sorting a .env that relies on order (rare, but dotenv-expand interprets later vars against earlier)
  • UPPERCASE-normalizing mixed-case keys that your framework reads case-sensitively
  • Grouping by prefix when teammates expect alphabetical — pick one convention
  • Auto-quoting values that contain legitimate single quotes — check the output

ENV Formatter — Clean up .env files

Think prettier for .env. Paste a messy file and this env formatter will sort keys, align equals signs, normalize casing, and strip duplicates — everything in-browser, nothing uploaded.

Frequently asked questions

Does formatting change my variable values?

No. Values are never modified — only structural aspects are changed: key ordering, whitespace alignment, casing of key names, and duplicate/empty line removal. Your actual config is untouched.

Will the formatter remove my comments?

Only if you enable 'strip comments'. By default, comments are preserved and grouped with the keys below them.

Is the output compatible with all dotenv parsers?

Yes. The formatter outputs standard dotenv syntax (KEY=value) with optional quoting for values containing spaces or special characters, compatible with dotenv (Node), python-dotenv, godotenv, and other major parsers.

Can I sort alphabetically within groups?

Yes. The 'sort' option sorts keys alphabetically within each comment-delimited group, so your grouped structure is preserved while keys within each group become easier to scan.

Related tools

Learn more

coming soon

Get notified when env syncing launches

We're building a tiny tool to keep .env files in sync across teammates and environments. Leave your email — no spam, just a single launch ping.