MODE

URL Encode and Decode

Make text safe for a URL, or read an encoded one.

INPUT
CHARS: 0WORDS: 0LINES: 0
OUTPUT
CHARS: 0WORDS: 0LINES: 0

How the URL Encode and Decode works

Reserved characters in a URL, such as spaces, ampersands and question marks, are replaced by a percent sign and two hexadecimal digits of their UTF-8 bytes. Component mode encodes everything except letters, digits and a handful of safe marks, which is right for a single query value. Whole URL mode keeps characters that give a URL its structure, such as the slash, colon and question mark. Form mode uses a plus sign for spaces, as HTML forms do.

Decoding reverses each of these and tells you if there is a malformed percent sequence.

URL Encode and Decode examples

  • Sample input with the default options

    Input

    https://example.com/search?q=café & tea

    Result

    https%3A%2F%2Fexample.com%2Fsearch%3Fq%3Dcaf%C3%A9%20%26%20tea

When it is useful

  • •Building query strings by hand for an API call.
  • •Reading encoded links from logs and redirects.
  • •Fixing a link that breaks because of an accent or a space.
  • •Debugging form submissions and tracking parameters.

Frequently Asked Questions

What is the difference between component and whole URL encoding?
Component encoding escapes characters like the slash and the ampersand, so use it for a value inside a query string. Whole URL mode leaves them alone so that the address keeps working.
Why is a space sometimes %20 and sometimes a plus?
The plus form comes from HTML form submissions. In a URL path, only %20 is correct.
How are non-English characters encoded?
As their UTF-8 bytes, each byte written as a percent sequence. The letter e with an acute accent becomes %C3%A9.

Guides that use this tool

Related tools

[ Browse all tools ]