URL Encoder / Decoder
Turn any text or URL into its percent-encoded form, or decode one back to plain text.
your-result-here
0 characters in · 0 characters out
How to use this URL encoder
Paste or type any text or URL into the box. Pick a mode and the result updates as you type. Use "Encode text for a URL" when you have one value to put inside a link, such as a search term. Use "Encode a whole URL" when you have a full address and only want the unsafe parts fixed. Use "Decode" when someone sends you a link full of %20 and %D8 codes and you want to read what it actually says. Copy the result with one click.
What is percent-encoding?
A URL can only contain a limited set of characters safely. Everything else has to be written as a percent sign followed by two hexadecimal digits, like %20 for a space. Letters and digits from other alphabets are first turned into UTF-8 bytes, then each byte is written the same way. That is why the Arabic word السلام becomes %D8%A7%D9%84%D8%B3%D9%84%D8%A7%D9%85. The characters A-Z, a-z, 0-9 and - _ . ~ are never encoded.
encodeURI vs encodeURIComponent
JavaScript has two built-in functions for this, and picking the wrong one is the most common mistake. The table below shows the difference.
| Function | Leaves alone | Use it for |
|---|---|---|
encodeURI | ; , / ? : @ & = + $ - _ . ! ~ * ' ( ) # | A whole URL. It keeps the structure (://, ?, &) intact and only encodes the unsafe parts. |
encodeURIComponent | A-Z a-z 0-9 - _ . ! ~ * ' ( ) | One value inside a URL, such as a search term or a path segment. It encodes ?, &, = and # too, so they cannot break the link. |
Run encodeURIComponent on a whole URL and it will encode the :// and the ?, which breaks the address. Run encodeURI on a search term that contains an & and the & stays, which splits your value into two parameters. When in doubt, encode each value separately and join them yourself.
Why it matters
Links break quietly. A space in a pasted URL can cut the link off at the space, so the person who clicks it lands on the wrong page or a 404. An & inside a search term can split one value into two parameters and change what the page shows. Non-English text in a link can arrive as a wall of percent codes that no one can read or trust. Encoding fixes all three before the link is shared. It also keeps analytics clean, because an unencoded space or bracket can make the same page show up as two different URLs in your reports.
Frequently asked questions
What does a URL encoder do?
It replaces characters that are not safe in a URL with a percent sign and two hexadecimal digits. A space becomes %20, an ampersand becomes %26, and non-English letters become a sequence of percent codes. A decoder reverses the process.
When should I encode a URL?
Encode when a link contains spaces, non-English letters, emoji, or characters like &, ? and # inside a value. You do not need to encode a plain address made only of letters, digits, hyphens and slashes.
What is the difference between encodeURI and encodeURIComponent?
encodeURI encodes a whole URL and leaves its structure alone, so ://, ? and & stay as they are. encodeURIComponent encodes one value inside a URL and escapes those characters too, so they cannot break the link apart.
Why did my %20 turn into %2520?
That is double encoding. The text was already encoded, and encoding it again turned the % itself into %25, so %20 became %2520. Use Decode once to get the original back, and only encode text that has not been encoded yet.
Is it safe to paste a URL here?
Yes. The tool runs entirely in your browser. Nothing you type is sent to a server, stored, or logged.
What does %2B mean in a query string?
It is an encoded plus sign. In a query string, a plain + is read as a space by many servers, so a real plus sign in your value has to be written as %2B to survive the trip.
Read the guide
When URLs Need Encoding (and When They Don't)
More free tools
Slug Generator · Canonical URL Generator · Meta Tag Generator