URL encoder and decoder
Percent-encode text for use in a web address, or decode percent-encoded text.
Your result
Your result will appear here.
About URL encoder and decoder
Use this to put a value into a web address without breaking it, such as a search term or a link inside a query parameter. It also reads addresses full of codes such as %20 and %C3%A9, as found in redirect links and server logs. With Encode text for a URL, characters that mean something in addresses, such as &, = and ?, are percent-encoded so they stay part of the value. Decode URL-encoded text turns every percent code back into its character.
How it works
Encoding runs the browser's encodeURIComponent function. English letters, digits, the marks - _ . ~ * ' ( ) and the exclamation mark stay as they are, and every other character becomes its UTF-8 bytes, each written as % and 2 hexadecimal digits. Decoding runs decodeURIComponent, which reads each %XX code as a byte and decodes the bytes as UTF-8 characters. Plus signs and all other text are left as they are.
Tips
- Encode each value on its own, not a whole address: encoding https://example.com/?q=1 turns / and ? into %2F and %3F and breaks the link.
- Spaces become %20, not +. Both work in query strings, but only %20 means a space in the path of an address.
- When decoding, a + stays a plus sign. In form data and many query strings + stands for a space, so replace it with a space before decoding those.
- A lone %, or a code that is not valid UTF-8 such as %E9 from an older Latin-1 page, stops the decoder with an error.
- Decoding a whole address turns %26 into & and %3D into =, which changes where it splits into parameters. Query string parser decodes each parameter separately.
Limits
Maximum 1 MB of input. Encoding is meant for one value, not a whole address: /, ? and & are encoded too. Decoding leaves a + sign as it is and stops at a lone % or at bytes that are not UTF-8.
How tools run on your device →Questions and answers
Why does é turn into %C3%A9?
In UTF-8, é is stored as 2 bytes, C3 and A9, and each byte gets its own percent code. Characters from other scripts take 3 or 4 codes in the same way.
Which characters does the encoder leave as they are?
English letters, digits and the marks - _ . ~ ! * ' ( ). Some request-signing schemes need the last 5 written as %21, %2A, %27, %28 and %29, so replace those by hand for such a scheme.
How do I turn %20 and other codes back into text?
Set Direction to Decode URL-encoded text, paste the encoded text in place of the example and run it. hello%20world%20%26%20privacy comes back as hello world & privacy.