Guides / SPF record longer than 255 characters: how to split it correctly

SPF record longer than 255 characters: how to split it correctly

Updated November 27, 2026

A single quoted string in a DNS TXT record can't be longer than 255 characters, but your SPF record can be. The fix is to split it into two or more quoted strings inside one TXT record, not into two records. Receivers glue the strings back together with nothing added between them, so the only way to break SPF while splitting is to lose a space at the join. Below: where the limit comes from, a safe way to split, the mistakes that turn a long record into a failing one, and when a long record is really a sign you have too many includes.

Check your domain nowFree SPF, DKIM, DMARC, MX and blacklist check. No signup.

Where the 255 limit comes from

DNS stores text as a "character-string". RFC 1035 defines it as a length octet followed by that many characters, and one octet can only count to 255. A TXT record is made of one or more of these strings, so the limit applies to each string, not to the whole record.

  • A long SPF record is fine as long as it is stored as several strings.
  • A 2048-bit DKIM key hits the same limit for the same reason, which is why DKIM key length comes up in the same DNS panels.

What the SPF standard says about multiple strings

RFC 7208 section 3.3 covers this case directly: "If a published record contains multiple character-strings, then the record MUST be treated as if those strings are concatenated together without adding spaces." It adds that multiple strings are "useful in constructing records that would exceed the 255-octet maximum length of a character-string within a single TXT record."

Its example is IN TXT "v=spf1 .... first" "second string...", which is equivalent to "v=spf1 .... firstsecond string...". Note the word without: the receiver does not insert a space where you split.

How to split a long SPF record safely

  1. Write the full record on one line first and check it is one valid v=spf1 ... ~all (or -all) record.
  2. Pick a split point between two terms, for example between two include: entries.
  3. Keep the space that separated the two terms inside one of the strings. Either end the first string with a space or start the second string with one.
  4. Put every string in its own pair of straight double quotes, in the same record, separated by a space outside the quotes.
  5. Save, wait for the record to publish, then run the free checker on the domain and confirm the SPF row shows the whole record, with every include, in one piece.

A worked example, with the mistake

Safe, with the space kept inside the first string:

  • "v=spf1 include:_spf.google.com include:spf.protection.outlook.com " "include:mailgun.org ~all"

Broken, because the space was dropped at the join. The receiver sees include:spf.protection.outlook.cominclude:mailgun.org, which is not a valid term, so the whole record is a permanent error:

"v=spf1 include:_spf.google.com include:spf.protection.outlook.com" "include:mailgun.org ~all"

Don't split it into two records

Two strings in one record is correct. Two separate TXT records that each start with v=spf1 is a different thing and it breaks SPF. RFC 7208 section 3.2 says: "A domain name MUST NOT have multiple records that would cause an authorization check to select more than one record." See multiple SPF records (permerror) if you already have two.

What your DNS panel does with long values

Panels differ, so check rather than assume. Some accept one long value and split it for you when they publish it. Some need you to type the quoted strings yourself. Some reject a value over 255 characters with a vague error. After saving, look at the published result, not the form: the free OutboxWatch checker shows the SPF value as receivers will read it, and a command like dig +short TXT yourdomain.com shows the stored strings in quotes.

Record size is a second limit

Even correctly split, a very long record has a different problem. RFC 7208 section 3.4 says the published SPF record "SHOULD remain small enough that the results of a query for it will fit within 512 octets," and gives a guideline that a DNS answer is likely to fit if the combined length of the name and the text of all records of that type is "under 450 octets." It also warns that records too long for one UDP packet "could be silently ignored by SPF verifiers" when DNS over TCP is blocked or broken.

The size of the answer includes every other TXT record on the same name, such as a site verification token or a second tool's record. That's one more reason to remove old TXT records you no longer need.

A long record usually means too many includes

Most SPF records that pass 255 characters got there by adding one sending tool after another. That leads to a separate failure: SPF allows only 10 DNS lookups, and each include: counts, including the ones nested inside the provider's own include. A record can be short and still over the limit, or long and under it. If yours is long, count the lookups too with SPF record too many lookups.

How to shorten a long SPF record

  1. Delete includes for tools you no longer send from. Check each tool's last send date before you remove it.
  2. Move bulk or marketing tools to their own subdomain with their own SPF record, so they don't share the record on your main domain.
  3. Prefer a tool's custom return-path (bounce) domain where it offers one, since SPF is checked on that domain and your main record can stay small.
  4. Be careful with flattening, which replaces includes with raw IP ranges. It shortens the lookup count but makes the record long, and the ranges go stale when the provider changes them.
  5. Re-run the check after every change and send a test message to confirm SPF still passes.

Keep it from breaking later

SPF records get longer over time and DNS edits are easy to get wrong by one space. OutboxWatch checks SPF, DKIM, DMARC, MX and blocklists on your sending domains every day and emails you when something changes, so a bad edit shows up the same day instead of after a campaign lands in spam.

Frequently asked questions

What is the maximum length of an SPF record?

One quoted string in a TXT record is limited to 255 characters. An SPF record can be longer if it is stored as several strings in one record. RFC 7208 also recommends keeping the whole answer small enough to fit in a 512-byte DNS reply, which in practice means well under about 450 bytes in total for all records of that type on the name.

Do I need a space between the quoted strings?

Spaces outside the quotes don't matter, because receivers join the strings with nothing between them. The space that separates two SPF terms has to be inside one of the quotes.

My SPF record is over 255 characters and the checker shows it as one record. Is that right?

Yes. A checker joins the strings the way a receiver does. If it shows the full record with every include, the split worked.

Is splitting the same as having two SPF records?

No. Splitting keeps one TXT record made of several strings. Two TXT records that both start with v=spf1 is a permanent error and SPF fails.

Does a long SPF record hurt deliverability?

Length by itself doesn't. A badly split record, more than 10 DNS lookups, or an answer too big to arrive can make SPF fail, and that does.

Find out what is wrong with your domainRun the free checker, or let OutboxWatch watch your domains daily and alert you when something changes.
Free weekly report for your domainOne email every Monday with your SPF, DKIM, DMARC, MX and blacklist status and what changed since last week. No card.
See the free weekly report

Related guides