URL encoder/decoder

Choose between encoding a full URL while keeping its structure, and encoding one component such as a query value. When decoding, every % sequence is checked and you are told where an invalid one is, instead of a silent failure. Use it to URL encode a value before you put it in a link, or as a URL decoder to read an encoded link.

Loading the tool…

Processing and privacy: The result is calculated inside your browser and your data is not sent to any server.

How to use it

  1. Choose the operation: “Encode” or “Decode”.
  2. Choose the mode: “Component” for one value or file name, or “Full URL” for a link that should still open.
  3. Paste the text or URL, or press “Load example” to try a link with Arabic words.
  4. Read the result. If the text is a valid URL, a table of its parts and query parameters appears underneath.
  5. Copy the result or download it as a text file.

Example

The text https://a.com/x y?q=1 becomes https://a.com/x%20y?q=1 in “Full URL” mode, so it is still a working link. In “Component” mode it becomes https%3A%2F%2Fa.com%2Fx%20y%3Fq%3D1, because : / ? = are encoded too. That is what you need when a whole URL goes inside a parameter of another URL.

The word ⁦مرحبا⁩ becomes %D9%85%D8%B1%D8%AD%D8%A8%D8%A7: each Arabic letter is two bytes in UTF-8, and each byte is written after a % sign.

Limits and caveats

  • Input is limited to 200,000 characters, which we tried in Chromium. Longer text is refused with a clear message.
  • Encoding is always UTF-8, as modern browsers do. Old links encoded with another charset such as Windows-1256 are reported as invalid UTF-8 and are not decoded.
  • “Full URL” mode does not decode reserved characters such as %2F, %3F and %26, because decoding them would change the meaning of the URL. Use “Component” mode to decode everything.
  • Encoding text that is already encoded encodes the % itself into %25 (double encoding). The tool warns you but does what you asked.
  • Arabic domain names are not converted to Punycode when encoding. The parts table shows the host name as the browser understands it.
  • The whole text is treated as one piece: a line break is encoded as %0A, and lines are not handled as separate URLs.

Questions about this tool

When should I use “Full URL” and when “Component”?

Use “Full URL” when you have a link with spaces or Arabic letters and want it to stay a link that opens; it leaves : / ? # & = alone. Use “Component” when you encode one value that will be placed inside a URL, such as a search term or a redirect link, because it encodes those characters too so they cannot be confused with the URL structure.

What does “a % that is not followed by two hexadecimal digits” mean?

In encoded URLs every % must be followed by two hexadecimal digits, as in %20. A % on its own, as in 100%, or followed by something else, as in %ZZ, is not valid encoding. If the % is part of the original text it must be written as %25.

Does + mean a space?

In web forms and query parameters + is used instead of a space; elsewhere in a URL it is an ordinary plus sign. So the tool leaves + alone by default, and you can turn on “Treat + as a space” in “Component” mode.

How do I decode a URL?

Choose “Decode” and “Component” mode, then paste the text: every % sequence turns back into its character. %D9%82%D9%87%D9%88%D8%A9%20%D8%B9%D8%B1%D8%A8%D9%8A%D8%A9 decodes to ⁦قهوة عربية⁩. Choose “Full URL” mode instead if the link structure must stay intact, because that mode leaves reserved characters such as %2F encoded.

How do I URL encode text with spaces or Arabic letters?

Choose “Encode” and “Component” mode and paste the text: each Arabic letter becomes two UTF-8 bytes and a space becomes %20. a b&c becomes a%20b%26c, because & = ? and / are encoded too in this mode, so the value cannot be confused with the URL structure. Use “Full URL” mode when a whole link should stay openable.