What is body-hash canonicalization?

Still have a question, spotted an error, or have a better explanation or a source we should cite?

Body-hash canonicalization is the step DKIM takes before computing the hash of your email body. "Canonicalization" means normalizing the content into a standard form before signing it. Without it, tiny formatting variations that happen in transit would cause constant signature failures, even when the actual message wasn't tampered with.

Why normalization is needed

Email bodies aren't always byte-for-byte identical between send and receipt. Trailing spaces get added or stripped. Line endings switch between CRLF and LF formats. Some mail relays add blank lines. If DKIM hashed the raw body as-is, these invisible differences would break signatures even on completely unmodified mail.

Canonicalization standardizes the body before hashing so that both sender and receiver are working from the same normalized version, regardless of minor transit changes.

Simple vs relaxed body canonicalization

And there are two modes:

  • Simple: Only strips trailing empty lines at the very end of the body. Everything else must match exactly. One extra space, one different line ending, and the signature breaks.
  • Relaxed: Strips trailing whitespace from each line, normalizes runs of whitespace to a single space, and ignores trailing empty lines. It survives most minor transit reformatting.

Relaxed is what nearly every ESP defaults to, and rightly so. Simple mode fails on any mail path that touches the body, and quite a few do.

The c= field in your signature

DKIM has two canonicalization settings: one for headers and one for the body. They're listed as a pair in the DKIM-Signature header's c= field. You'll see something like c=relaxed/relaxed (header/body) or c=relaxed/simple. Most senders run relaxed for both.

You can see your current settings by pasting a received email into our email header analyzer. If you're investigating body-hash failures (dkim=fail where the signature is present but not verifying), the SOS hotline is free.

Contributors

Who worked on this answer

Every name links to their profile. Every company links to their site. Real people, real accountability.

Ask an AI · tailored to your setup

Fix My Body-Hash Canonicalization

I just read the Email Almanac entry on body-hash canonicalization. Help me check what canonicalization mode my DKIM setup is using and whether it's causing signature failures. Walk me through: 1. Reading the c= field from a DKIM-Signature header to see my current header/body modes 2. Whether switching from simple to relaxed body canonicalization would fix my failure pattern 3. How to change the canonicalization mode if my ESP supports it 4. How to confirm the new mode is in effect after the change --- My details (fill in what applies): - Sending domain: your domain - DKIM-Signature c= field from a recent email: e.g. "relaxed/simple" or "simple/simple" - Where dkim=fail is appearing: specific providers or forwarding destinations - ESP or mail platform: name - Whether relay or forwarding is in the mail path: yes / no / unsure

Edit the yellow boxes, then send to the AI of your choice.