URL Parser

URL Parser

Parse any URL into its individual components instantly

What is a URL?

A URL (Uniform Resource Locator) is a reference to a web resource that specifies its location on a computer network and the mechanism for retrieving it. URLs are a specific type of URI (Uniform Resource Identifier) defined in RFC 3986. Every time you type an address in your browser, click a link, or call an API, you are using a URL.

URL Structure & Components

A URL is composed of several distinct parts, each serving a specific purpose. Here is the anatomy of a complete URL:

https://user:pass@www.example.com:8080/path/to/resource?key=value&foo=bar#section
scheme userinfo host port path query fragment
  • Protocol / Scheme— Defines how the resource should be accessed (e.g., https, ftp, mailto).
  • Userinfo— Optional username and password for authentication, separated by a colon and followed by @.
  • Host— The domain name or IP address of the server (e.g., www.example.com).
  • Port— The network port on the server. Defaults to 80 for HTTP and 443 for HTTPS when omitted.
  • Path— The specific resource location on the server, structured like a file path.
  • Query String— Key-value pairs after the ?, separated by &. Used to pass parameters to the server.
  • Fragment / Hash— The part after #, used for client-side navigation within a page. It is never sent to the server.

Query String Encoding

Query parameters are key-value pairs appended to a URL after the question mark (?). Each pair is separated by an ampersand (&), and the key is separated from the value by an equals sign (=). Special characters within keys and values must be percent-encoded as defined in RFC 3986. For example, a space becomes %20 (or + in form submissions), and an ampersand within a value becomes %26.

The browser's built-in URL and URLSearchParams APIs automatically handle decoding of percent-encoded characters, making it easy to extract the original values from query strings programmatically.

RFC 3986 — URI Standard

RFC 3986 is the Internet standard that defines the syntax of Uniform Resource Identifiers (URIs). Published in January 2005, it supersedes the earlier RFC 2396 and establishes the generic grammar that all URI schemes must follow. The standard defines the concept of percent-encoding, reserved characters, and the hierarchical structure of URIs including scheme, authority, path, query, and fragment components.

This URL parser follows the WHATWG URL Standard, which is the living standard used by all modern browsers. It provides a superset of RFC 3986 with additional rules for handling real-world URLs encountered on the web, including internationalized domain names and special scheme handling.

Frequently Asked Questions

A URL parser is a tool that breaks down a URL (Uniform Resource Locator) into its individual components: protocol, host, hostname, port, pathname, query string, query parameters, hash/fragment, and origin. This makes it easy to inspect, debug, and understand the structure of any URL.

This tool uses the browser's built-in URL constructor (new URL()) to parse URLs. This is the same standards-compliant parser that browsers use internally to process URLs, following the WHATWG URL Standard. All parsing happens entirely in your browser -- nothing is sent to any server.

The hostname is the domain name or IP address of the server (e.g., 'www.example.com'). The host includes both the hostname and the port number if one is specified (e.g., 'www.example.com:8080'). If the URL uses a default port (80 for HTTP, 443 for HTTPS), the host and hostname will be the same.

The URL origin is the combination of the scheme (protocol), hostname, and port. For example, 'https://www.example.com:8080' is an origin. Origins are a fundamental concept in web security -- the browser's Same-Origin Policy uses origins to determine whether scripts from one page can access resources from another.

A URL must include a valid protocol/scheme (like 'https://' or 'http://') to be parsed correctly. If you enter just a domain name like 'example.com', it will be treated as invalid. Try adding 'https://' before your URL. The parser follows strict WHATWG URL Standard rules.

The hash (or fragment) is the part of a URL after the '#' symbol. It identifies a specific section or element within the page. Fragments are processed entirely by the browser and are never sent to the server in HTTP requests. They are commonly used for anchor links, single-page application routing, and scroll-to-section functionality.

Yes. This URL parser runs 100% in your browser using JavaScript's native URL API. Your URLs are never uploaded, transmitted, or stored on any server. You can even disconnect from the internet after the page loads and the tool will continue to work.

Percent-encoding (also called URL encoding) is a mechanism to represent special characters in URLs. Characters that have special meaning in URLs (like '&', '=', '?', '#') or non-ASCII characters are replaced with a '%' followed by their hexadecimal byte values. For example, a space becomes '%20' and an ampersand becomes '%26'. The URL parser automatically decodes these for you.