User agent strings and URL anatomy explained

Published by InstantToolDeck · Updated November 2026

Two strings show up in almost every web debugging session: the URL and the user-agent. Both look messy, but each has a clear structure.

Anatomy of a URL

https://user@shop.example.com:8443/search/shoes?q=trail&page=2#results
└─┬─┘   └─┬─┘ └──────┬───────┘└─┬─┘└────┬─────┘└────┬─────┘ └──┬──┘
scheme  user      host       port   path       query       fragment
  • Scheme: https, http, mailto and so on.
  • Host: the domain name. Subdomains come before the main domain.
  • Port: optional. 443 is the default for https.
  • Path: the resource on the server.
  • Query: name=value pairs separated by &. Used for search terms, filters and tracking tags like utm_source.
  • Fragment: after #. It stays in the browser and is never sent to the server.

Percent-encoding

URLs may only contain a limited set of characters, so others are encoded as % plus two hex digits: space is %20, & is %26. In query strings a plus sign often means space. The URL Parser splits a URL and decodes each parameter, and the URL encoder converts single values.

Anatomy of a user-agent string

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

It starts with Mozilla/5.0 for historical reasons. The part in brackets describes the system. AppleWebKit and Safari appear because early sites checked for them. The token that identifies the browser is the most specific one, here Chrome/124. Edge adds Edg/… and Opera adds OPR/… after Chrome's tokens.

Paste any string into the User Agent Parser to see the browser, engine, system and device type.

Practical tips

  • User agents are being reduced by browsers for privacy, so versions may be frozen. Use feature detection, not user-agent sniffing, to decide what code to run.
  • Bots usually identify themselves, for example Googlebot, but some fake it. Verify important crawlers by reverse DNS.
  • Strip tracking parameters from URLs before sharing them.

Frequently asked questions

What does %20 mean in a URL?

It is an encoded space. Other characters are encoded the same way, for example %26 for an ampersand.

Why does every user agent start with Mozilla/5.0?

It is a historical compatibility token from the early browser wars that every browser kept.

Does the part after # get sent to the server?

No. The fragment is used only by the browser.

Can I rely on the user agent to detect a mobile device?

Only roughly. Use CSS media queries and feature detection for layout and behaviour instead.

← All guides