URL Encoder and Decoder
Choose encode or decode, pick the style and type your text. You get the result and the character counts. Everything is worked out on this page.
Your numbers
How we calculate it
Percent-encoding replaces each unsafe character with a % and the two hexadecimal digits of each of its UTF-8 bytes, so a space is %20, an & is %26 and the letter é, which is two bytes, is %C3%A9. Letters, digits and a few signs such as - _ . ~ stay as they are.
The style says which characters are kept. For a part of a URL, characters that have a meaning in a URL (: / ? # & = + and others) are encoded too. For a whole URL they are kept so the address still works. For HTML form data spaces become + and nearly everything except letters, digits and * - . _ is encoded. Decoding reverses each style. In the form style a + becomes a space.
Assumptions and limits
- Encode only the parts of a URL, such as a query value, and not an address that already has % codes in it, or the % signs get encoded again (%20 becomes %2520).
- Text that is not valid percent-encoding, such as a stray % or bytes that are not UTF-8, cannot be decoded and gives a message.
- The limit is 4,000 characters of input. The page output is plain text and is never run as code.
Frequently asked questions
What is URL encoding?
It is a way to write characters that are not allowed in a URL, or that have a special meaning, as a % followed by two hexadecimal digits. It is also called percent-encoding.
Why does a space become %20 or +?
In a URL path or a query value a space is written %20. In HTML form data (the application/x-www-form-urlencoded format) a space is written as +. Choose the style that matches where the text will be used.
What is the difference between encoding a part and a whole URL?
Encoding a part also encodes : / ? # & and =, which is right for a value inside a URL. Encoding a whole URL leaves them alone so the address keeps its structure.
Related calculators
- Base64 Encoder and DecoderChoose encode or decode and type your text.
- Binary and Hex ConverterType a whole number, say which base it is in and which base you want.
- Subnet CalculatorEnter an IPv4 address and the prefix length (the number after the slash, such as 24).
- PX to REM ConverterEnter a size, choose the direction and the base font size.
Worked example (a fixed example using the starting numbers, it does not change as you type)
Inputs: Mode = Encode (text to %XX form); Text or URL = https://example.com/search?q=café & more; Style = Part of a URL (a query value or a path piece).
- Result https%3A%2F%2Fexample.com%2Fsearch%3Fq%3Dcaf%C3%A9%20%26%20more
- Characters 40 characters in, 63 characters out
Embed this calculator
Add this calculator to your own page. Paste the code where you want it. The small link keeps credit to the source.