TestingAPIs is still being built. If something breaks, email support@testingapis.com.

URL encoder and decoder

Runs in your browser; nothing is uploaded

Percent-encode text for a URL, decode it back, or split a URL into its parts and query parameters.

Text

Encodes everything except letters, digits and - _ . ! ~ * ' ( ). Use it for one query value or path segment.

Encoded

The encoded text appears here as you type.

Ready

What is URL encoding?

URL encoding, also called percent-encoding (RFC 3986), replaces characters that are not allowed or have a special meaning in a URL with a % followed by two hexadecimal digits. A space becomes %20, & becomes %26 and / becomes %2F. Other characters are first converted to UTF-8 bytes, so é becomes %C3%A9.

It matters because some characters structure the URL itself. ? starts the query string, & separates parameters, = separates a name from its value and # starts the fragment. If a search term contains & and isn't encoded, the server reads it as the start of a new parameter.

Encode each value on its own, not the whole URL. Encoding a complete URL as a value also encodes its ://, / and ?, which breaks it; that is what the whole-URL mode is for, when you only need to fix spaces and accents in an otherwise correct URL.

How to use this tool

  1. 1Choose Encode, Decode or Parse. Switching keeps your text; Swap (Alt+Shift+S) moves the output into the input and switches between Encode and Decode.
  2. 2To encode, choose what the text is: a value (encodeURIComponent), a whole URL (encodeURI), or form data, where spaces become +. The line above the editor says exactly which characters each one keeps.
  3. 3To decode, paste the encoded text. Turn on + means space for form data and query strings sent by HTML forms. If a sequence is malformed or isn't UTF-8, it is marked in the editor and F8 goes to it.
  4. 4If the result still contains %XX, the text was encoded twice; Decode again in the status bar decodes it once more.
  5. 5Each line separately treats every line as its own value, for a list of values. Parse splits one URL into scheme, host, port, path, fragment and a table of decoded query parameters, which you can copy as JSON.

Troubleshooting

% must be followed by two hexadecimal digits
The text has a literal percent sign, such as 100%, or a sequence that was cut off. A real percent sign is written %25 in a URL.
%E9 is not valid UTF-8 at this point
The text was encoded by an old encoder that used Latin-1 instead of UTF-8, so é became %E9 instead of %C3%A9. Re-encode the original text, or have the sender use UTF-8.
A + turned into a space, or a space stayed a +
+ means space only in form data (application/x-www-form-urlencoded), such as a query string an HTML form sent. Turn + means space on or off to match where the text came from.
Not an absolute URL
Parse needs the scheme and host, such as https://api.example.com. Paths such as /users?page=2 are relative to a page and can't be parsed on their own.

Frequently asked questions

What is the difference between encodeURI and encodeURIComponent?

encodeURIComponent encodes everything except letters, digits and - _ . ! ~ * ' ( ), so it is right for a single value. encodeURI leaves the characters that structure a URL, such as : / ? # & = +, untouched, so it is right for a whole URL that only needs unsafe characters fixed.

Should a space be %20 or +?

In a path and in most APIs, use %20. + means space only in form data, which is what browsers send for HTML forms and what many query strings use. When decoding a query string written by a form, turn on + means space.

Why does Parse show a different URL from the one I pasted?

Parse uses the browser's URL parser, which normalizes the URL: it lowercases the scheme and host, removes a default port such as :443, and percent-encodes spaces and non-ASCII characters. Copy URL copies that normalized form.

Is my input sent to a server?

No. Encoding, decoding and parsing run in your browser, and nothing you paste is uploaded. To survive a reload, what you paste is kept in this tab's session storage until you clear it or close the tab. Copy link puts the input in the link after #, which browsers never send to a server, but anyone you give the link to can read it.