URL Parser / Query String Splitter
Parse a URL into its components (scheme, protocol, userinfo, host, port, subdomain, domain, TLD, path, file, query string, hash) and split the query string into decoded parameters.
https://…), scheme-less URLs (www.example.com/page, https is assumed), relative URLs (/path?query), IPv4/IPv6 hosts and mailto:, tel:, urn:, data: URIs are all supported. The result updates as you type.Result
URLs Explained
URI, URL and URN
A URI (Uniform Resource Identifier) is a string of characters that identifies a resource. It is the umbrella term, defined by RFC 3986. A URL (Uniform Resource Locator) is a URI that also tells you where the resource is and how to fetch it: https://www.example.com/index.html names a document and says "get it over HTTPS from that host". A URN (Uniform Resource Name) is a URI that gives a resource a persistent, location-independent name, such as urn:isbn:0451450523 for a book, without saying where to find a copy. Every URL and every URN is a URI, but the terms are not interchangeable.
Syntax of a URI
In its most general form a URI is scheme:scheme-specific-part?query#fragment. The scheme decides how the rest is interpreted. Some examples taken from the RFCs:
| URI | Scheme | Scheme-specific part |
|---|---|---|
ftp://ftp.is.co.za/rfc/rfc1808.txt | ftp | Host and path of a file on an FTP server |
http://www.ietf.org/rfc/rfc2396.txt | http | Host and path of a web document |
ldap://[2001:db8::7]/c=GB?objectClass?one | ldap | An IPv6 host in brackets, a distinguished name and an LDAP query with ?-separated fields |
news:comp.infosystems.www.servers.unix | news | A Usenet newsgroup, no host at all |
tel:+1-816-555-1212 | tel | A telephone number |
telnet://192.0.2.16:80/ | telnet | An IPv4 address with an explicit port |
urn:oasis:names:specification:docbook:dtd:xml:4.1.2 | urn | A namespace (oasis) and a namespace-specific string |
Syntax of a URL
Hierarchical URLs (those whose scheme-specific part starts with //) follow this structure:
scheme://username:password@host:port/path/file-name.suffix?query-string#hash
└─┬─┘ └──────┬────────┘ └─┬┘ └┬┘ └──────────┬──────────┘ └────┬─────┘ └─┬┘
scheme userinfo host port path query fragment
└────────────── authority ──────────────┘
└──────────── resource ────────────┘
| Part | Description |
|---|---|
| Scheme / protocol | How to access the resource: http, https, ftp… Case-insensitive, conventionally lower-case. The "protocol" shown by this tool is the scheme followed by :// (or by : for non-hierarchical URIs), matching the location.protocol value of browsers. |
| Userinfo | Optional username:password before an @. See the warning below. |
| Host | A domain name (www.example.co.uk), an IPv4 address (192.0.2.16) or a bracketed IPv6 address ([2001:db8::7]). Domain names are case-insensitive and are split by this tool into subdomain, domain and TLD; multi-label public suffixes such as co.uk or com.au are recognized. |
| Port | Optional TCP port. When absent, the default port of the scheme is used (see the table below). |
| Path | The hierarchical part, split by this tool into directory (up to the last slash), file name and file suffix (the extension). Case-sensitive on most servers. |
| Query string | Everything after the first ?, up to the fragment. See below. |
| Fragment / hash | Everything after the first #. Identifies a part of the resource (an element id, a video timestamp, a route in a single-page application) and is handled entirely by the client: browsers never send it to the server. |
Examples: https://www.example.com/products/list.html?category=shoes&page=2#top, ftp://[email protected]:2121/pub/readme.txt, file:///C:/Users/tom/report.pdf, ws://localhost:3000/socket.
Syntax of a URN
A URN is urn:<namespace identifier>:<namespace-specific string>. The namespace identifier (NID) is registered with IANA and defines the meaning of what follows:
urn:isbn:0451450523— a book, by ISBN.urn:ietf:rfc:2648— an IETF RFC.urn:uuid:6e8bc430-9c3a-11d9-9669-0800200c9a66— a universally unique identifier.urn:oasis:names:specification:docbook:dtd:xml:4.1.2— an OASIS specification.
A URN never changes even when the resource moves, which is why standards bodies, libraries and XML namespaces like them. Resolving a URN to an actual location requires a separate lookup service.
The userinfo, and why passwords in URLs are dangerous
The username:password@ part was designed for FTP and early HTTP authentication. It is still parsed by every client, but embedding credentials in a URL is a bad idea: the URL ends up in browser history, bookmarks, server and proxy logs, the Referer header sent to other sites, screenshots and chat messages, and it is trivially readable by anyone looking at the address bar. Modern browsers strip or hide the userinfo, and RFC 3986 explicitly deprecates the password form. Use proper authentication (headers, tokens, cookies) instead, and if you find a URL with credentials in a log, treat those credentials as compromised.
The query string
The query string carries parameters to the resource. By convention (not by RFC, which only defines it as opaque text) it is a list of key=value pairs separated by &: ?p1=v1&p2=a%20b&p2=c. A key may appear several times, which most frameworks turn into an array, and a key may have no value at all (?debug). Characters that are not allowed literally are percent-encoded (%20 for a space, %26 for an ampersand, %3D for an equal sign) and, in the application/x-www-form-urlencoded format used by HTML forms, a space may also be written as +. This tool shows both the raw and the decoded value of each parameter; use the URL encoder to encode values yourself.
The fragment
The part after # is the fragment (or "hash"). It refers to a secondary resource inside the primary one: an element with a matching id on an HTML page, a text fragment (#:~:text=…), a page number in a PDF viewer, a time offset in a media file. Because it is only meaningful to the client, browsers never send it to the server and changing it does not reload the page, which is what client-side routers rely on.
Common schemes and default ports
| Scheme | Default port | Purpose |
|---|---|---|
http | 80 | Hypertext Transfer Protocol (web) |
https | 443 | HTTP over TLS |
ftp | 21 | File Transfer Protocol |
sftp / ssh | 22 | Secure Shell and SSH file transfer |
telnet | 23 | Remote terminal (insecure) |
smtp | 25 | Sending e-mail (587 for submission, 465 for SMTPS) |
pop3 | 110 | Retrieving e-mail (995 over TLS) |
imap | 143 | Retrieving e-mail (993 over TLS) |
ldap / ldaps | 389 / 636 | Directory access |
ws / wss | 80 / 443 | WebSocket, plain and over TLS |
file | — | Local file (file:///C:/path); the host is usually empty |
mailto | — | E-mail address, optionally with ?subject=…&body=… |
tel | — | Telephone number |
data | — | Inline data: data:text/plain;base64,SGVsbG8= |
urn | — | Persistent name (see above) |