# DKIM Canonicalization: Simple vs Relaxed Explained

URL: https://email-validation.org/guides/dkim-canonicalization/
Updated: 2026-11-27

> Documentation index: https://email-validation.org/llms.txt

The `c=` tag of a DKIM-Signature tells a verifier how the signed header fields and the body were prepared before
signing, so it can prepare them the same way. The relaxed setting absorbs some formatting changes, such as a run of
spaces in the body. It cannot make a changed subject or a new footer equal to the original text. The header and body
rules are separate, even when a signature uses the same setting for both.

If mail passes DKIM at your sender but fails after a relay, read the `c=` tag before you decide what to investigate.
Then check which header fields the signature covers, whether the relay changed the body, and whether the receiver
could find the right public key. Each check answers a different question.

## How to read the c= tag

Read the two names as header/body ([RFC 6376](https://www.rfc-editor.org/info/rfc6376/), section 3.5):

| Tag | Header fields | Body |
|---|---|---|
| `c=simple/simple` | simple | simple |
| `c=relaxed/simple` | relaxed | simple |
| `c=simple/relaxed` | simple | relaxed |
| `c=relaxed/relaxed` | relaxed | relaxed |
| `c=relaxed` | relaxed | simple: with one name, the body uses simple |
| No `c=` tag | simple | simple: the default |

The signer chose these rules when it created the signature, and the verifier applies the ones the signature names;
it does not try a more forgiving mode. A message can carry several DKIM signatures, so when you compare results from
different hops, compare the same signing domain and selector.

## What happens to signed header fields

With **simple** header canonicalization, header fields are used exactly as they are: field names are not
lowercased and whitespace is not changed (section 3.4.1). A change to a covered field's name case, folding or spacing
changes the input and breaks the signature.

**Relaxed** header canonicalization (section 3.4.2) lowercases the field name, unfolds continuation lines, turns
every run of spaces and tabs into a single space, deletes whitespace at the end of the value, and deletes whitespace
before and after the colon. It leaves the letters of the value alone. It does not reinterpret the subject, normalize
a different character, or undo an edit to an address.

Suppose the signed header is `Subject: Status update` and a relay changes only the field name, to
`SUBJECT: Status update`. The relaxed form is unchanged, so that edit alone does not break a relaxed signature, but it
changes the simple input. If the relay changes the value to `Subject: STATUS update`, the input changes even under
relaxed rules. Each case assumes that Subject is covered and nothing else changed. The signature's `h=` tag names the
signed header fields.

## What happens to the body

Both methods ignore empty lines at the very end of the body; an empty line is one with nothing before its line
ending (section 3.4.3). In **simple** mode, a line holding only spaces is not empty, and spaces inside a line are part
of the input.

**Relaxed** body canonicalization (section 3.4.4) also ignores spaces and tabs at the end of each line and reduces
every run of spaces and tabs inside a line to one space, then ignores empty lines at the end. So a line with three
spaces between "Delivery" and "update" and a line with one space there produce the same relaxed input, but
different simple input. These rules work on the transmitted body. They do not compare how two HTML
messages look in a browser, and they do not treat two different encodings as equal because they show the same text.

## Three relay edits to check

1. **A header was rewrapped, the text stayed the same.** A relay refolds a signed header field with ordinary
   continuation whitespace. Relaxed mode tolerates that when the canonical value is unchanged; simple mode does not.
   Compare the actual header lines of both copies, not what a mail program displays.
2. **Blank lines or spaces changed.** Extra empty lines at the very end of the body are ignored by both modes. Extra
   spaces at the end of a non-empty line are ignored in relaxed mode but break simple mode. That is why two messages
   that look identical can get different results.
3. **A footer appeared.** A footer with text, a rewritten link or any other added content normally changes the
   signed body under both modes. The optional `l=` tag limits how many octets of the canonicalized body were signed
   (section 3.5). If it is present, check the signed length before you treat appended text as proof that a signature
   must fail.

## Two security limits of a passing signature

A pass with `l=` says nothing about content beyond the signed length. RFC 6376 (section 8.2) warns that the tag lets
an intermediary append content that can replace the original in the reader's eyes, that signers should be extremely
wary of using it, and that assessors might wish to ignore signatures that use it. Do not sign with `l=` yourself.

A signed field also does not mean every instance of that field is signed. Someone holding a genuine signature can add
an extra header field, such as a second Subject or From, by interception or replay. Section 8.15 describes the fix:
signers list a field name in `h=` one time more than it occurs (for example `h=from:from:...` for one From), so that
an added instance breaks the signature.

## Where the DNS key check fits

The `d=` tag names the signing domain and `s=` the selector. Together they locate the public key record the
verifier needs ([DKIM selectors and key rotation](https://email-validation.org/guides/dkim-selectors-key-rotation/)). Our
[DKIM checker](https://email-validation.org/tools/dkim-checker/) looks up that public record for a domain and selector and reports on the key it
finds: its size, its syntax, test mode and revoked keys. It does not take a received message, rebuild the signed
header and body, or verify that message's signature.

If the key is missing or wrong, start with the signing domain, the selector and the key setup. If the right key is
published but the receiver reports a body hash mismatch, compare a saved original with the received copy, using the
signature's body setting. Then look at any system that adds disclaimers, rewrites links or changes the MIME encoding.
A DNS check can narrow the search, but cannot settle whether the body was changed.

A useful order: find the failing signature, read `c=` and `h=`, check for `l=`, then compare the two copies at the
hop where the result changed. Use a fictional example in public tickets. Raw production headers and bodies belong
only in an authorized private support channel.

## Questions

### Which canonicalization should I sign with?

RFC 6376 (section 3.4) leaves it to the signer. Relaxed tolerates common changes such as whitespace replacement and
header rewrapping; simple tolerates almost none and suits a signer that wants any change at all to fail.

### Why did DKIM fail after a mailing list?

The list most likely changed the subject or added a footer. Relaxed rules do not cover that, so the signature breaks
under either mode.

### Does relaxed mode ignore case in header values?

No. Only the field names are lowercased. A change of case in the value changes the input.

## Try it

Look up the public key for your domain and selector with the [DKIM checker](https://email-validation.org/tools/dkim-checker/), or create a new
key pair with the [DKIM generator](https://email-validation.org/tools/dkim-generator/).

## Related

- [Glossary: SPF, DKIM and DMARC](https://email-validation.org/glossary/#spf-dkim-dmarc).
- [DKIM checker](https://email-validation.org/tools/dkim-checker/).

## Related guides

- [DKIM selectors and key rotation](https://email-validation.org/guides/dkim-selectors-key-rotation/)
- [What does ARC-Seal mean in a forwarded email?](https://email-validation.org/guides/arc-seal-forwarded-email/)
- [Moving DMARC from p=none to p=reject](https://email-validation.org/guides/dmarc-none-to-reject/)
- [How to read DMARC aggregate reports](https://email-validation.org/guides/dmarc-aggregate-reports/)
- [The SPF 10-lookup limit explained](https://email-validation.org/guides/spf-lookup-limit/)
- [All guides](https://email-validation.org/guides/)

## Sources

- [IETF: RFC 6376, DomainKeys Identified Mail (DKIM) Signatures](https://www.rfc-editor.org/info/rfc6376/):
  section 3.4 (canonicalization and its examples), 3.5 (the `c=`, `h=`, `d=`, `s=` and `l=` tags), 6.1
  (verification and the body hash), 8.2 (misuse of `l=`), 8.15 (extra header fields).

_How we wrote this: drafted by the email-validation.org team with the help of AI writing tools, from our product documentation and the sources linked in the text._

## Get up to 500 free credits. No card needed.

New accounts get 500 free credits (100 when you sign up with a free email provider such as Gmail, Outlook or Yahoo, another personal mailbox such as a paid one like Fastmail or one from your internet provider, or an address from a relay or alias service). Try it on your own list before you buy. [Create your account](https://email-validation.org/signin/?new=1) or [open the free email checker](https://email-validation.org/email-checker/).
