WebmasterID logoWebmasterID
User agents

User-agent string length and truncation

User-agent strings have grown long thanks to layered compatibility tokens, and intermediaries sometimes cap their length. A database column, log format, or proxy that truncates the string silently corrupts downstream parsing, turning a known browser into an unknown one. Knowing where truncation happens helps you keep UA data intact.

Verified against primary sources

Why strings get long

Modern user agents carry layered compatibility tokens — a Mozilla prefix, an AppleWebKit chain, a Chrome token, brand tokens, platform tokens — for historical browser-detection reasons. The result can be a long string, and brand variants or embedded app tokens add even more.

This length matters because anything in the request path that imposes a maximum can cut the string short. Once truncated, the tail that often carries the distinguishing brand or version is lost.

Where truncation happens and how to detect it

Common culprits are fixed-width database columns, log formats with a length cap, and proxies or WAFs that clip oversized headers. A telltale sign is a user agent that ends mid-token, or a sudden rise in unknown/unparseable agents that all share the same cut-off point.

To avoid it, size storage generously, confirm your log format preserves the full header, and capture the UA as early as possible — at the edge — so later stages cannot silently shorten it. When you must store a bounded copy, prefer parsing first and keeping structured fields.

How it appears in analytics and logs

A user agent that ends abruptly mid-token, or parses as unknown despite looking browser-like, often signals truncation somewhere in the pipeline rather than a genuinely unusual client.

Diagnostic use case

Diagnose why a user agent fails to parse, recognise truncation introduced by storage or proxies, and size fields so the full string survives.

What WebmasterID can help detect

WebmasterID captures the user agent server-side at the edge, before app-layer fields or downstream stores can clip it, so classification works on the complete string rather than a truncated copy.

Common mistakes

Privacy and accuracy notes

A user-agent string describes a client, not a person, whether full or truncated. Truncation is a data-integrity issue, not a privacy control, and WebmasterID treats the UA as a coarse signal regardless of length.

Related pages

Sources and verification notes

Last reviewed 2026-06-24. Facts are checked against primary/official sources where available; uncertain specifics are marked “Data not yet verified” rather than guessed.