%url-decoder.net

Parts of a URL Explained (and URL vs URI vs URN)

Updated November 18, 2026 · 5 min read

Short answer

A URL has up to seven parts: scheme, optional username and password, host, optional port, path, optional query and optional fragment, written as scheme://user:pass@host:port/path?query#fragment. Every URL is a URI; URI is the general term in the standards, and URL is the everyday word for one you can locate and fetch.

Every URL follows the same pattern defined in RFC 3986. Knowing the parts makes it much easier to see why a link breaks, which part needs encoding, and what a server actually receives.

The parts, labelled

https://user:pass@www.example.com:8080/docs/guide.html?lang=en&page=2#install

Parsed with the WHATWG URL class, the same parser browsers use: try it in the URL Parser.

PartValueWhat it does
Schemehttps:How to reach the resource: https, http, ftp, mailto and so on.
Username and passworduser:passOptional credentials. Browsers hide or block them; avoid them in links.
Hostwww.example.comThe domain name or IP address of the server.
Port8080Optional. Omitted when it is the default: 443 for https, 80 for http.
Path/docs/guide.htmlWhich resource on the server, as segments separated by /.
Query?lang=en&page=2Optional key=value parameters after ?.
Fragment#installOptional. A position within the page, used only by the browser.

The host and port together are the authority, and scheme, host and port together are the origin, here https://www.example.com:8080. Browsers use the origin for security rules such as which pages may read each other's data.

URL, URI and URN

  • URI is the general term in RFC 3986 for an identifier with this syntax.
  • URL is a URI that tells you where the resource is and how to get it, such as an https address.
  • URN names a resource without locating it, such as urn:isbn:0451450523.

In web development the terms URL and URI are used interchangeably, and the WHATWG URL Standard that browsers follow uses “URL” throughout.

Which characters each part allows

Each part has its own delimiters, so a character that is harmless in one part breaks another. A / is fine in a query value but splits a path; a ? is fine inside the query but ends a path; a # ends whichever part it appears in. That is why values are encoded per part with a component encoder. See invalid URL characters and the percent-encoding table.

Questions

What is the difference between a URL and a URI?

URI (Uniform Resource Identifier) is the general term used by RFC 3986 for any identifier with this syntax. A URL is a URI that also tells you how to locate the resource, such as an https address. In everyday web work the two words are used interchangeably, and the WHATWG standard simply calls them URLs.

What is a URN?

A URN is a URI that names something without saying where to find it, such as urn:isbn:0451450523 for a book. You cannot fetch a URN directly.

Which parts of a URL are case-sensitive?

The scheme and host are case-insensitive. The path, query and fragment are case-sensitive in general, although some servers treat paths case-insensitively.

Is the part after # sent to the server?

No. The fragment is used by the browser only, for example to scroll to a heading. It is not part of the HTTP request.

See also

Try everything in this guide hands-on, free and entirely in your browser.

Split a URL in the URL Parser

Keep reading