Toolstia / URL encoder and decoder
Encode and decode URLs
A web address can only safely carry a limited set of characters, so anything else, such as a space, an ampersand, a non-English letter or an emoji, has to be written as a percent sign and two hexadecimal digits. This tool does that translation in both directions, and it lets you choose whether you are encoding one value or a complete address.
Developers use it when building query strings, redirect URLs and API calls. Marketers use it for campaign links, and anyone can use it to read a long encoded link and see what it really says. All conversion is done in the page without a server. Because it uses the standard encoding functions built into your browser, the output matches what JavaScript code would produce.
How it works
- Choose encode or decode.
- For encoding, choose whether you are encoding one value or a whole web address.
- Paste your text and copy the result.
Value or full address
Encoding "a value" also encodes the characters / ? & = : and #, which is right for a single parameter such as a search term. Encoding "a full web address" leaves those characters alone so the link keeps working.
What %20 means
A percent sign followed by two hexadecimal digits stands for one byte. %20 is a space, and an accented letter such as é becomes two codes (%C3%A9) because it is stored as two bytes in UTF-8.
Plus signs
In form data, a plus sign can mean a space. When decoding, plus signs are turned into spaces. When encoding a value, a real plus sign is written as %2B.
Decoding errors
A stray % that is not followed by two valid digits cannot be decoded. The tool tells you instead of guessing.
Two modes, shown with the same input
Encode the text a b&c=d/é? as a value and you get a%20b%26c%3Dd%2F%C3%A9%3F. Every character that has a special job in an address has been escaped, so the whole string is now safe to use as the value of a single parameter.
Now encode the address https://ex.com/a b?q=é&x=1#top as a full address. The result is https://ex.com/a%20b?q=%C3%A9&x=1#top. The scheme, slashes, question mark, equals sign, ampersand and hash are left alone, so the link still has its structure, and only the space and the é are escaped.
Why encoding the same text twice breaks it
The percent sign itself is a character that gets escaped. Running a full address that already contains %20 through the encoder turns it into %2520, where %25 stands for the percent sign. A server will decode that only once and see the literal text %20 instead of a space.
A good rule is to encode each piece exactly once, at the moment you put it into the address. If a link looks like it has 25 inside its codes, as in %2520 or %253A, it has probably been double-encoded, and decoding once will bring it back one level.
Why é becomes two codes and an emoji becomes four
Text is first converted to UTF-8 bytes, and each byte is written as a percent code. Plain letters are one byte, é is two bytes (%C3%A9), a Bangla letter takes three, and an emoji such as the grinning face takes four. The Bangla word ঢাকা, with four characters, becomes twelve bytes and comes out as %E0%A6%A2%E0%A6%BE%E0%A6%95%E0%A6%BE.
Modern browsers show the readable form in the address bar, but the encoded form is what is sent over the network, and it is what you need inside code, emails and spreadsheets.
Characters the tool leaves untouched
Letters, digits and the symbols - _ . ~ are never escaped. In value mode the characters ! ' ( ) * are also left as they are, so it's (ok)! becomes it's%20(ok)!. That is standard behavior of the underlying browser function, and it is safe for query values. If a system you send to insists on escaping those too, replace them by hand with %21, %27, %28, %29 and %2A.
Decoding: plus signs, percent signs and old character sets
When decoding, a plus sign is turned into a space first, because that is how HTML forms write spaces, and then the percent codes are decoded. This means a real plus written as %2B survives, so a+b%20c%2B decodes to a b c+. The catch is a plain plus in a path, such as C++, which will read as spaces. If you need to keep it, replace the plus signs with %2B before decoding.
A lone percent sign, as in 100%, cannot be decoded and gives an error message. Codes that are not valid UTF-8, for example %E9 from an old Latin-1 page, are also rejected, since the tool only reads UTF-8.
Questions
Is my text sent anywhere?
No. Encoding and decoding happen in your browser.
Should I encode the whole address or just the value?
Encode only the value you are putting into the address, such as a search term. Encoding the entire address as a value would break the slashes and question mark.
Does it handle emoji and other languages?
Yes. Text is encoded as UTF-8, which covers every language and emoji.
Should a space be %20 or a plus sign?
Use %20 in paths and when in doubt. A plus means a space only inside form-style query strings, and this tool writes %20 when encoding.
Does it encode the part before the question mark?
In full-address mode, existing slashes and the structure of the address are kept, and only unsafe characters are escaped. It does not validate that the address exists.
Why does my link still contain a # after encoding?
In full-address mode a hash is treated as the start of the fragment and kept. Switch to value mode to encode it as %23 when it is part of data.
Can I encode a whole query string at once?
Encode each value separately in value mode and join them with ampersands yourself. Encoding the whole string as a value would also escape the equals signs and ampersands that structure it.
Is percent-encoding a security measure?
No. It keeps an address valid, but anyone can decode it. Do not rely on it to hide secrets or to sanitize user input.