Format email headers + DKIM
Unfolds continuation lines, normalises whitespace, then refolds long DKIM and Received values at semicolons for readable inspection. Runs locally.
From: alice@example.com To: bob@example.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=example.com; s=selector1; h=From:To:Subject:Date:Message-ID; bh=abc123; b=def456== Received: from mail.example.com (mail.example.com [192.0.2.1]) by mx.recipient.com with ESMTPS id ABC123 for <bob@example.com>; Mon, 20 May 2026 09:15:00 +0000 Subject: Hello world
How email header folding works
RFC 5322 lets a header value wrap over multiple lines if continuation lines start with whitespace (LWSP). This tool unfolds first, then refolds at logical boundaries.
- 01
Paste raw headers
The block before the first blank line in a .eml file, or the headers section of a bounce report.
Parsing runs through Prettier’s standalone bundle (or the language-specific equivalent) loaded lazily — no parser ships until the tool is opened.
emailPrettierASTstandalonelazyinput · sourceraw · ASTFrom: a@b DKIM-Sig: v=1;
loaded · parsedAST · ready - 02
Unfold continuations
Lines starting with space or tab attach to the previous header's value.
Indent width, tab style, and print-width re-format through a memoised pass — switching
2 → 4spaces never re-parses, only re-prints.unfoldindentprint-widthmemoisedlivejoin · optionslwsp · livecont → joined
options applied · livelive - 03
Refold at ; boundaries
Values longer than 78 chars wrap at semicolons — natural for DKIM, Received, and SPF.
The formatter is deterministic and idempotent: running it twice produces byte-identical output, which keeps diffs and git noise to a minimum.
refoldidempotentdeterministicdiff-cleanstablewrap · formatted>78 · readyDKIM-Sig: v=1; d=ex.com;
formatted · liveidempotent - 04
Copy or save
Use the readable form for an audit, then re-encode with the original folding for actual sending.
Download writes a
Blobwith the language-appropriate extension; copy usesnavigator.clipboard.writeTextso the output preserves all whitespace exactly.exportclipboardbloblanguage MIMEclient-sideok · copiedready · done✓ Copied
shipped · ready to shipsuccess
Formatting tips that keep diffs sane
Pick one config and pin it
Inconsistent formatting causes diff churn. Commit .prettierrc / .editorconfig and enforce in CI.
Format on save
Editor integration is faster feedback than a pre-commit hook. Use both for belt-and-braces.
Idempotency matters
Running the formatter twice should produce identical output. Test this on a representative file.
Match the language community
Default to community conventions: 2 spaces for JS/CSS, 4 for Python, tabs for Go. Fights over indent are a productivity tax.
Print-width drives wrapping
80, 100, and 120 are the common targets. Wider lines parse fast but review slower side-by-side.
Don’t mix formatters and linters
Prettier handles whitespace; ESLint handles correctness. Disable overlapping rules to avoid fight-club configs.
When to format headers
DKIM debugging, deliverability audits, forensics.
DKIM debugging
Read selector, domain, and signed-header list at a glance. Idempotent: running the formatter twice produces byte-identical output, which is the foundation of a clean CI gate. Pair with a pre-commit hook so PRs arrive already formatted, focusing review on logic.
idempotentSPF / DMARC
Inspect Authentication-Results without horizontal scroll. Pairs with EditorConfig + .prettierrc for end-to-end consistency. Whitespace-only changes vanish so reviewers see real diffs, and git blame stays honest about who wrote what.
CI-readyPhishing review
Examine Received chains to trace an email's actual path. Output respects your indent width, tab style, and print-width — settings carry over for repeat runs. Switching 2-space to 4-space costs nothing in CPU but standardises an entire codebase.
diff-cleanBounce parsing
Make NDR headers legible for support tickets. Format-on-save is the fastest feedback loop; CI is the safety net. Together they make inconsistent indentation a thing of the past and free up review cycles for genuine concerns.
PR-friendlyMail gateway tuning
Compare headers before and after a relay rewrites them. Whitespace-only changes don't trigger downstream content-hash invalidations, so CDN cache keys and CI cache layers stay warm. Real changes get all the rebuild budget.
review-readyCompliance
Capture headers as evidence in a readable form. Pairs with linters (ESLint, Stylelint, pylint) that catch what formatting alone can't — bugs, unused imports, dead code. Each tool stays in its lane, and the codebase stays clean.
deterministicFrequently asked questions
Something missing?
Tell us what you need. We ship the top requests every two weeks.