Home › Developer Tools › URL Parser and Query Builder

URL Parser and Query Builder

Paste an absolute URL to split it into its parts. Edit the query pairs and the URL is rebuilt with correct percent-encoding.

Enter a URL.

Parts

PartValue

Query pairs

Pairs are kept in order, and a repeated name stays repeated. Edit a name or value, add a pair, or remove one.

Name (decoded)Value (decoded)No = signRemove

Rebuilt URL

-
Nothing you type is sent, stored or saved, and the URL is not requested. The page does not visit the address it parses.

How to use

  1. Paste an absolute URL into the URL box. It must start with a scheme such as https://. The Parts table lists the scheme, user, password, host, port, path, query and fragment.
  2. Look at the Query pairs table. Each row is one name and value, shown decoded. Edit a cell to change it.
  3. Press Add pair to append a new row, or Remove to delete one. Tick No = sign when a name should appear without a value, as in ?debug.
  4. Tick Form encoding if the query follows the HTML form convention, where a plus sign means a space.
  5. Copy the Rebuilt URL from the bottom of the page.

Worked example

The box starts with https://user:pw@example.com:8080/a/b.html?x=1&x=2&y=a%20b#top. The tool splits it into scheme https, user user, password pw, host example.com, port 8080, path /a/b.html and fragment top. The query gives three pairs, in order: x = 1, x = 2 and y = "a b", where the value was decoded from a%20b.

Now replace the pairs with a single pair, q = "café & tea". With form encoding off, the rebuilt URL ends ?q=caf%C3%A9%20%26%20tea#top: the accented letter becomes its two UTF-8 bytes, the space becomes %20 and the ampersand becomes %26 so it cannot be mistaken for a pair separator. A value of "a b" with form encoding on is written q=a+b.

How it works

The URL is split by its own rules: the scheme comes first, then // introduces the user, password, host and port, then the path, then the query after ?, then the fragment after #. Only absolute URLs with a scheme are accepted. A relative URL, or one with no scheme, is refused with a message.

Each query pair is split at its first =, so x=1 and x=1&x=2 keep their order and their repeated name. A name with no = has no value at all, and that is kept as written.

Names and values are shown decoded. Rebuilding encodes each one again: a space becomes %20, or + when form encoding is ticked, and every other character outside the unreserved set is written as its UTF-8 percent escape. The same values come back, but the escapes may be written differently from the original text. A malformed escape such as %G1, or bytes that are not valid UTF-8, is refused and the position is shown.

The generic syntax is set out in RFC 3986. The unreserved characters, which never need escaping, are letters, digits and the four marks - . _ ~. The plus-for-space rule is not part of RFC 3986. It comes from the application/x-www-form-urlencoded format described in the WHATWG URL Standard, which browsers follow.

Common mistakes

Frequently asked questions

What is the difference between %20 and +?

Both can mean a space. The %20 form works everywhere in a URL. The plus form is valid only in form-encoded query strings.

Does the fragment get sent to the server?

No. The part after # stays in the browser, which is why it is used for in-page jumps and some app state.

Does the tool open the address?

No. It only reads the text you paste. The address is never requested.

Why was my URL refused?

The usual causes are a missing scheme, a relative path, or a malformed escape such as %G1. The message under the box names the problem.

Why is the rebuilt URL not identical to the original?

The decoded values are the same, but the escaping is normalised. For example, lower-case escapes become upper case.

Related tools