712Tools
5 min read

User-Agent strings in 2026: parsing, Client Hints, and privacy

The User-Agent string is a mess โ€” Chrome pretends to be Safari, Edge pretends to be Chrome. But it's still what your analytics reads. Here's how to parse it, when to trust it, and where Client Hints are taking us.

By
Software Engineer ยท M.Sc. Mechanical Engineering ยท Ontario, Canada

Why UA strings look insane

A typical modern Chrome User-Agent:

Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36

This one string claims to be:

  • Mozilla/5.0 โ€” Netscape (1996)
  • AppleWebKit/537.36 โ€” Safari's engine (2003)
  • KHTML โ€” Konqueror's engine (1998)
  • like Gecko โ€” Firefox's engine
  • Chrome/125.0.0.0 โ€” the actual browser
  • Safari/537.36 โ€” again claiming Safari

Every major browser lies in its UA string, layered on top of the last lie, because sites sniffing UAs would block "unknown" browsers. Chrome pretended to be Safari to bypass Safari sniffers. Edge pretended to be Chrome. Firefox pretended to be Netscape 5. Now every browser inherits every lie.

Parsing the modern soup

The reliable parts of a modern UA:

  • The last Browser/Version token usually names the actual browser. Chrome/125, Edg/125, Firefox/128, Safari/17.
  • The parenthetical section describes the platform. (Windows NT 10.0), (Macintosh; Intel Mac OS X 10_15_7), (iPhone; CPU iPhone OS 17_5).
  • The rendering engine โ€” AppleWebKit, Gecko, Trident (dead) โ€” usually appears before the browser token.

The order of tokens matters. Edge appears at the end (Edg/125) after Chrome; missing that suffix means the parser thinks Edge is Chrome. User-Agent Parser handles the ordering correctly โ€” it identifies Edge before matching Chrome.

What you can and can't infer

Reliable:

  • Browser family (Chrome, Firefox, Safari) โ€” usually correct.
  • OS family (Windows, macOS, Linux, iOS, Android) โ€” usually correct.
  • Whether it's mobile โ€” the Mobile token in the UA is reliable enough for layout decisions.

Unreliable:

  • Exact version numbers. All Chromium browsers now freeze the major version at "Chrome/109" or use Client Hints for the real version. Reading Chrome/xxx from UA doesn't give you the current version.
  • Device model. Some Android devices include it (SM-G991B), Apple devices don't (iPhone is all you get).
  • Bot detection. Every serious bot spoofs a real browser UA. UA sniffing catches only lazy scrapers.

Client Hints โ€” the real successor

Chromium browsers now send Client Hints โ€” a set of HTTP headers that carry structured versions of what the UA string tried to convey:

  • Sec-CH-UA: "Chromium";v="125", "Not:A-Brand";v="24"
  • Sec-CH-UA-Mobile: ?0
  • Sec-CH-UA-Platform: "Windows"

You get more with high-entropy hints (opt-in via response header):

  • Sec-CH-UA-Platform-Version
  • Sec-CH-UA-Full-Version-List
  • Sec-CH-UA-Model
  • Sec-CH-UA-Arch

For anything server-side that needs accurate client info in 2026, prefer Client Hints over the UA string. Every Chromium browser sends them; Firefox and Safari don't (yet โ€” Safari has said no).

The three legitimate use cases for UA

Despite the mess, UA sniffing still has real uses:

1. Analytics. You need "% of visitors on mobile" and "which browsers we support." Aggregate stats where individual accuracy doesn't matter.

2. Content negotiation. Serving WebP to browsers that support it (via UA or Accept header โ€” prefer Accept).

3. Bug reports. "Report a bug" forms benefit from including the parsed UA โ€” helps you reproduce the environment.

Where UA sniffing is the wrong tool

Feature detection. Always prefer if (typeof x !== "undefined") over "if it's Chrome, use X." Browsers ship the same feature at different times; UA-based branching goes stale within months.

Conditional CSS. Modern CSS @supports queries beat UA-based CSS. @supports (display: grid) is more accurate than "if Chrome โ‰ฅ 57."

Bot blocking. UA is trivially spoofable. Use rate limiting, honeypots, and behavioral signals instead.

Privacy: UA is high-entropy fingerprinting

A UA string plus a screen size plus a timezone plus a set of installed fonts identifies most users uniquely across sites. That's why:

  • Safari reduced its UA โ€” most Macs report the same UA regardless of version.
  • Firefox's Enhanced Tracking Protection freezes UA in private windows.
  • Chromium's User-Agent Reduction removed minor version and platform info from the default UA, moving them to opt-in Client Hints.

The direction: less info by default, structured hints on request. If you're building a service that logs UAs, treat them as PII and apply the same retention policies you'd apply to IP addresses.

Debugging server logs and analytics

When investigating "why is X% of my traffic showing as Unknown Browser?":

  1. Grep for the UA strings marked Unknown. Usually you'll find one common pattern.
  2. Paste it into User-Agent Parser to see what it actually is.
  3. Check for new browsers โ€” Brave (Chromium-based), Vivaldi, Arc, DuckDuckGo mobile. They ship distinct UA tokens but most parsers miss them.
  4. Look for bots that stopped spoofing โ€” SEO tools, uptime monitors, some AI crawlers now proudly identify themselves.

Related: for AI crawlers specifically, check GPTBot, ClaudeBot, PerplexityBot, and CCBot in your logs. They're distinct from browser UAs and worth tracking as their own segment.

Testing UA-conditional code

When your code branches on browser detection, test with:

  • curl -A โ€” send a custom UA. Convert curl commands with cURL Converter to get equivalent fetch/axios code.
  • Chrome DevTools โ†’ Device Emulation โ€” spoofs UA + viewport + Client Hints.
  • Bug reports with the real UA โ€” paste into User-Agent Parser to reproduce the browser environment.

Never rely on if (userAgent.includes("Chrome")) โ€” Edge, Opera, Brave, and every other Chromium browser include "Chrome" in their UA.

Related workflows

Tools mentioned in this post

Written by Shan

Shan builds 712 Tools. He holds a Master's degree in Mechanical Engineering and now works as a Software Engineer, shipping browser-based developer utilities out of Ontario, Canada. Learn more ยท 712studiogames@gmail.com