ToolLaunchpad
Encoders, decoders and hashes

URL Encode and Decode

Make text safe for URLs and query parameters with percent-encoding, or turn an encoded URL back into readable text.

URL Encode / DecodeRuns in your browserCtrl+Enter runs

Runs entirely in your browser. Nothing you enter is uploaded or stored.

How to use it

Paste text and press Encode or Decode. Pick the mode first:

  • Component (default) encodes everything except letters, digits and - _ . ~. Use it for a single query parameter value, a path segment, or anything you insert into a URL. It is equivalent to JavaScript's encodeURIComponent, plus encoding of ! ' ( ) * for strict RFC 3986 output.
  • Full URL keeps characters that give a URL its structure, such as : / ? # & =, and only encodes spaces and other unsafe characters. Use it to clean up a complete URL that contains spaces or non-ASCII letters. It matches encodeURI.

Tick Spaces as + if you work with HTML form data (application/x-www-form-urlencoded), where a space is written as + instead of %20. When decoding with this option on, + is turned back into a space.

Worked example

You want to link to a search for café & bar. Inserting it raw breaks the URL, because & starts a new parameter. In Component mode the value becomes:

caf%C3%A9%20%26%20bar

so the final link is https://example.com/search?q=caf%C3%A9%20%26%20bar. Notice that é becomes two bytes, %C3%A9: URLs encode the UTF-8 bytes of a character, not the character itself.

Decoding works the other way: paste https://example.com/?city=K%C3%B6ln&q=a%2Bb in Component mode and you get https://example.com/?city=Köln&q=a+b.

Common characters and their encoding

CharacterEncodedWhy it matters
space%20 or +Spaces are not allowed in URLs
&%26Separates query parameters
=%3DSeparates name and value
?%3FStarts the query string
#%23Starts the fragment; everything after it is not sent to the server
/%2FSeparates path segments
+%2BMeans a space in form encoding

Common errors

  • "% is not followed by two hex digits": a literal percent sign, as in 50% off, was never encoded. Encoded, it should be %25. The error message tells you the position.
  • "Bytes do not form valid UTF-8": the text was encoded in an older character set such as Latin-1, where é is %E9 rather than %C3%A9. Modern browsers and servers expect UTF-8.
  • Double encoding: if you see %2520, a space was encoded twice (%20 and then the % again as %25). Decode twice, and fix the code that encodes it a second time.
  • Plus signs turning into spaces: some servers decode + as a space in query strings. Encode a literal plus as %2B to be safe.

Frequently asked questions

What is the difference between encodeURI and encodeURIComponent?

encodeURI is meant for a complete URL and leaves characters like : / ? # & and = untouched. encodeURIComponent is meant for a single value and encodes those characters too. Use Component mode for query values and Full URL mode for whole links.

Should a space be %20 or +?

In URL paths and in most APIs a space is %20. In HTML form submissions and some query strings it is written as +. Turn on Spaces as + only when you work with form-encoded data.

Why does é become %C3%A9?

URLs carry bytes, and in UTF-8 the letter é is stored as the two bytes C3 and A9. Each byte is written as a percent sign followed by two hexadecimal digits.

What does %2520 mean in a URL?

It is a double-encoded space. The space became %20, and then the percent sign was encoded again as %25. Decoding twice gives the original text.

Is my input sent anywhere?

No. Encoding and decoding use your browser's built-in functions and nothing leaves your device.

More free Launchpad tools