URL encoder and decoder
- Protocol
https:- Username
user- Host
xn--bcher-kva.example- Host in Unicode
bücher.example- Port
8443- Path
/guide/café- Encoded path
/guide/caf%C3%A9- Fragment (#)
#top
Everything runs in your browser; nothing is sent or stored.
- Enter text and click "Encode", or paste encoded text and click "Decode".
- Choose "URL component" for a parameter value, or "Full URL" for a complete URL.
- Tick "Space as +" to encode and decode form data.
- When decoding malformed text, the tool shows the position of the character where the invalid sequence starts.
- In the "URL parser" section, enter a full URL to get its protocol, host, port, path, fragment, and list of parameters.
- Copy the result or a parameter value with the "Copy" button.
What is URL encoding
A URL can contain only some ASCII characters: English letters, digits, and a few symbols, such as the hyphen, the period, and the underscore. Any other character, such as a space or an accented letter, is written with percent-encoding: the character is converted to bytes in UTF-8, and each byte is written as a % sign followed by two hexadecimal digits. For example, a space is written as %20, and the letter é takes 2 bytes, so it is written as 6 characters: %C3%A9.
URL component or full URL
The characters /, ?, &, =, and # separate the parts of a URL. When you encode a parameter value, you must encode the separators too, or they change the structure of the URL. For example, the value a&b is encoded as a%26b, and without encoding, the & character would start a new parameter. The "Full URL" option suits a complete URL that contains spaces or non-ASCII characters, and leaves the separators in place. Encoding a complete URL with the "URL component" option turns https:// into https%3A%2F%2F, and the URL stops working.
The structure of a URL
A full URL starts with the protocol, such as https:, followed by the host, that is, the domain name or the IP address, and sometimes a port. When the URL has no port, the default port of the protocol is used: 443 for HTTPS and 80 for HTTP. The URL parser shows the default port with the label "(default)". After the host come the path, the query string, which starts with ? and holds parameters in the form name=value separated by &, and the fragment, which starts with # and points to a specific place on the page. The path is shown in two forms, in the "Path" and "Encoded path" rows. A parameter can appear more than once, for example tag=a&tag=b, and the URL parser shows each occurrence in its own row, in the order it appears in the URL.
Common encoded characters
%20a space.+a space in form data, when the "Space as +" option is ticked.%2Bthe + character.%26the & character, which separates parameters.%3Dthe = character, which separates the parameter name from its value.%2Fthe / character.%3F and %23the ? and # characters.%25the % character itself.caf%C3%A9the word "café": 4 letters, 5 bytes in UTF-8.
URL encoder and decoder FAQ
Why does my URL show %2520 instead of a space?
The %2520 sequence comes from double encoding. The first encoding turns the space into %20, and the second turns the % character into %25. To fix it, decode the text again and again until you get the original text, and then encode it only once.
Is there a difference between %20 and + for a space?
Yes. In the URL path, a space is written as %20, and the + character stays a regular character. In form data, a space is written as +, and the + character itself is written as %2B, so when decoding form data, tick the "Space as +" option. In the list of parameters in the "URL parser" section, the + character is always shown as a space.
Why do I see a message about a malformed encoded sequence?
The message appears when the % character is not followed by two hexadecimal digits, for example in the text 100%, or when the sequence does not represent valid UTF-8 text, for example text encoded in Windows-1252. When the % character is part of the text, encode it as %25.
Why does decoding in "Full URL" mode leave some sequences encoded?
In "Full URL" mode, the sequences of the separator characters, such as %2F, %3F, %23, %26, and %3D, stay encoded, so that decoding does not change the structure of the URL. To fully decode a value, choose the "URL component" option.
Why does the URL parser say the URL is not valid?
The "URL parser" section needs a full URL that starts with a protocol, such as https://. A URL without a protocol, such as www.example.com, cannot be parsed, and a message says the protocol may be missing.
What does xn-- mean in the host name?
A domain name with non-ASCII characters, such as accented letters or a non-Latin script, is converted to Punycode form, which contains only English letters, digits, and hyphens, and starts with xn--. The URL parser shows the host in both forms, in the "Host" and "Host in Unicode" rows, even when you enter the URL with non-ASCII characters. To convert a domain name between the two forms, you can use the IDN converter (Punycode).