BlogIntegrations · October 29, 2026 · 5 min read

Contact Form 7 Payload Size: Measure UTF-8 Bytes Before a Lead Handoff

Separate visible characters from encoded payload bytes, measure serialized JSON and diagnose size failures without silently truncating CF7 lead messages.

Green geometric blocks pour from an envelope onto a balance beside a transparent container with a capacity line.
Generated conceptual illustration; not a product screenshot or measured result.

A Contact Form 7 message fits the visible character limit but fails when a connector sends it to a destination API. The field may be valid while the encoded request is too large. Visible symbols, JavaScript string length, UTF-8 bytes and the size of a complete serialized request measure different things.

This guide explains a byte-budget check for custom lead adapters. It complements our textarea limit guide; it does not replace that field-level configuration. The examples are synthetic calculations, not measured CF7 performance or a claim about a specific CRM’s limits.

Identify the limit and its boundary

Read the receiving API’s current documentation. Is the limit per field, per JSON document, per batch or per HTTP request? Does it apply before or after compression? A database column limit and a proxy request-body limit can reject different stages. Record the exact limit, unit, endpoint and documentation date.

Then locate the component that sends the data. A CF7 form may feed an extension, a custom PHP adapter or a separate worker. Those components can serialize the same answers differently. Do not assume CF7 sends the JSON format shown below, or that installing an analytics plugin creates that outbound handoff.

Measure UTF-8 bytes rather than guessing from characters

MDN’s TextEncoder documentation describes conversion into UTF-8 bytes. For a local synthetic example, the ASCII letter A occupies one UTF-8 byte, é occupies two, and the single code point 😀 occupies four. A visible emoji sequence can contain several code points.

const message = "Aé😀";
const messageBytes = new TextEncoder().encode(message).length;
// messageBytes is 7; this is an encoding example, not a site metric.

This calculation does not establish whether an address, message or character sequence is acceptable to the destination. It answers only the encoded-length question for that string. Keep validation and size handling as separate checks with separate failure reasons.

Measure the exact serialized body

The request includes more than the message: property names, quotation marks, delimiters and other fields also take space. Serialization can introduce escapes. Use the serializer and configuration that the real adapter uses, then count the resulting encoded bytes. MDN’s JSON.stringify reference explains the JavaScript serialization boundary.

const payload = { message: "Aé😀" };
const body = JSON.stringify(payload);
const bodyBytes = new TextEncoder().encode(body).length;
// body is {"message":"Aé😀"}; bodyBytes is 21.

The example is compact JSON without extra whitespace. A serializer configured to escape non-ASCII characters can produce a larger representation while conveying the same decoded text. Pretty printing, additional metadata and nested records also change the result. A field-only calculation is therefore insufficient for a whole-body limit.

Use the correct calculation in each runtime

For a Python adapter, encode the final serialized string as UTF-8 and measure the resulting bytes. For a PHP adapter, measure the serialized byte string produced by the chosen JSON options, checking serialization errors first. Do not transfer a JavaScript character-count assumption into another language and call the results equivalent.

RFC 8259 specifies UTF-8 for JSON exchanged between systems outside a closed ecosystem. That does not imply that every API accepts every Unicode string or that its size limit excludes HTTP headers. Match the actual API contract rather than a general format rule.

Preserve the original message when a limit is exceeded

Do not silently cut a byte string at an arbitrary position. That can break an encoded character and, more fundamentally, remove information the recipient needs. A truncated question can reverse its meaning or omit the detail that makes a reply possible. Keeping the final request valid is not enough if its content becomes misleading.

Choose a documented recovery path: an actionable validation response, a supported long-text destination, a smaller batch, or an authorized reference to a separately stored message. Keep the full original only in an approved location with appropriate retention. Do not move lead text into an analytics parameter or a public file to avoid a size limit.

Separate rejection from an unknown delivery outcome

The HTTP 413 reference describes a request whose content exceeds the server’s accepted limit. Record which boundary returned the response. Retrying the same oversized body repeatedly does not make it smaller, and increasing a shared server limit is not an appropriate first diagnostic step.

A timeout or disconnected response is different: the destination may already have accepted the request. Use the destination’s documented status lookup or idempotency mechanism before retrying. Our rate-limit guide covers another class of retry decisions; keep size errors distinguishable from throttling and transient transport failures.

Build a boundary-focused acceptance set

Use synthetic short ASCII, accented text, a single emoji, a joined emoji sequence, quotation marks, backslashes and multiline content. Include payloads just below, exactly at and just above the documented limit. Count both the message bytes and the complete body bytes, then inspect the request produced by the real adapter in staging.

Record expected handling and the resulting destination value. Confirm that rejected payloads remain reviewable and that accepted ones preserve their full meaning. Avoid logging raw lead text merely to count bytes: a correlation identifier, byte total, endpoint and reason code are usually more useful operational evidence.

For aggregate form submission trends, see our free Svetlik Analytics for Contact Form 7. We operate CF7 Analytics. Submission reporting does not verify a downstream byte budget or guarantee that a CRM received the complete message. Keep that evidence with the adapter’s own checks.