URL Parser

Split one absolute URL into protocol, host, path, query, and hash.

Use this tool

Result

The result appears in this panel after you run the tool.

About this tool

The URL constructor reads the string and the page prints the protocol, host, path, query, and hash. A relative path has no scheme, so it fails.

Query String Builder makes one encoded pair. This page reads a URL you already have.

How to use it

  1. Paste an absolute URL, including the scheme.
  2. Parse it.
  3. Read the protocol, host, path, query, and hash.

Limitations

An absolute URL split into labeled parts

The URL class requires a scheme

The URL class splits an absolute address into labeled lines. The paste is passed to the URL constructor. A relative path, a host with no scheme, and an empty box fail, because there is no base URL to resolve against. The page does not fetch the address. It does not check that a host exists. It only splits a string the constructor accepts.

The lines are protocol, host, pathname, search, hash, and then a query section. Protocol includes the colon. Host includes a port when one was written, and it does not include a username. The page does not print a separate userinfo line. Pathname is the path. Search is the raw query, including the question mark when a query exists. Hash includes the hash mark when a fragment exists. Under the query heading, each parameter is key, equals, value, from the URL’s parameter list. When there are no parameters, that section says none.

Decoding and repeated keys

Parameter values are the decoded values the URL class exposes. A percent-encoded space and a plus in the query can both show up as a space in the value line, while the search line still shows the raw query. Repeated keys appear as repeated lines, in order. The parser does not collapse them. It does not pretty-print JSON that happens to be in a parameter. If a value is itself Base64 or JSON, it stays a string on that line.

Building a query is the other page

The query-string builder encodes one key and one value and does not parse a full URL. This page parses a full absolute URL and does not let you edit one field and rebuild. If you change a parameter, edit the original string or use the builder for a new query and splice it yourself. Fragments are not sent to servers in ordinary requests, but they are still printed here because they are part of the string. Use this page to see the parts. It will not open them.

Privacy

Your input is processed in your browser and is not uploaded to UtilChain. File names, text, and results are not sent to analytics.