Step 1 Pick Encode or Decode
Use the switch above the result, then paste your text on the left or click Sample. The result updates as you type. Swap moves the result to the left and flips the direction, which is a quick way to check a round trip.
Paste text on the left
Spaces become %20, & becomes %26 and é becomes %C3%A9What’s in this link
A web address can only hold a small set of characters: letters, digits and a few marks like - _ . and ~. Everything else gets written as a % sign followed by
two hex digits. A space is %20, an ampersand is %26, and é is
%C3%A9 (it takes two bytes in UTF-8, so it gets two codes). That’s URL encoding, also called
percent-encoding.
It matters because some characters have a job in a URL. Say you want a search link for “coffee & cake”. Written
as ?q=coffee & cake, the & starts a new parameter and the server only sees
“coffee ”. Encoded, it’s ?q=coffee%20%26%20cake and the whole phrase arrives in one piece. Decoding goes the other
way: it turns a link full of %20 and %C3%A9 back into text you can read.
Paste the examples into the tool above to try them. Everything runs in your browser.
Use the switch above the result, then paste your text on the left or click Sample. The result updates as you type. Swap moves the result to the left and flips the direction, which is a quick way to check a round trip.
The Type menu decides which characters are left alone.
/ ? & = # too.
:, /, ?, & and = that hold the URL
together.
+, the way an HTML form sends them. Same result as
JavaScript’s URLSearchParams.
Text:
Hi Sam, coffee at 3? Form data:
Hi+Sam%2C+coffee+at+3%3F
Got a list of search terms? Tick Each line and every line is encoded on its own, so you get one
encoded value per line instead of one long string full of %0A (that’s the line break).
Switch to Decode and paste the link. + is a space is on by default because query strings use it that way. Turn it off if your text has real plus signs, like a phone number in a path. Tick Decode until clean when a link was encoded twice (more on that below).
Broken codes don’t stop the tool. It decodes what it can, leaves the rest exactly as it was and tells you where the problem is:
Input:
Save 50% today: %E0%A4%A What the tool says:
When you paste a whole link, a What’s in this link box shows up under the result. It splits
the address into host, path and the part after #, and lists every query parameter with its value
decoded. It’s the quickest way to see what a tracking link or a long redirect is really sending. Then click
Copy.
Building the <a> tag around your link? The HTML Link
Generator writes it for you, with the right target and rel.
These are the ones that trip people up, shown as the default A value type writes them. Letters,
digits and - _ . ~ stay as they are, with one exception: Form data also encodes the
tilde, so ~ becomes %7E there.
| Character | Encoded | Why it matters |
|---|---|---|
| (space) | %20 | Or + in form data and query strings |
| & | %26 | Separates query parameters |
| = | %3D | Joins a name to its value |
| ? | %3F | Starts the query string |
| / | %2F | Separates folders in the path |
| # | %23 | Starts the part after # (the fragment) |
| % | %25 | Starts every code, so a real % needs one too |
| + | %2B | A + on its own can mean a space |
| : | %3A | Used after https and before a port |
| @ | %40 | Used before the host in user@host |
| " | %22 | Double quote |
| é | %C3%A9 | Two bytes in UTF-8, so two codes |
| ü | %C3%BC | Also two bytes |
| € | %E2%82%AC | Three bytes |
| ☕ | %E2%98%95 | Three bytes |
| 😀 | %F0%9F%98%80 | Emoji take four bytes |
JavaScript has two built-in encoders, and this tool’s A value and Full URL types match them exactly. The difference is which characters they leave alone.
encodeURIComponent: for one value
encodeURIComponent('tea & biscuits?')
// 'tea%20%26%20biscuits%3F' encodeURI: for a whole address
encodeURI('https://example.com/café menu?drink=flat white')
// 'https://example.com/caf%C3%A9%20menu?drink=flat%20white'
The first one encodes the & and the ? because, inside a value, they’re just text. The
second keeps them, since a full URL needs its ? and &. The catch: encodeURI can’t tell
an & that splits parameters from one that’s part of a value. Encode each value with the component
version, then put the URL together.
Both mean a space in a query string, because HTML forms have always sent spaces as +. These two links
search for the same thing:
https://example.com/search?q=flat+white
https://example.com/search?q=flat%20white
Outside the query string it’s different. In /downloads/c++.pdf the pluses are real pluses. So
%20 is the safe choice when you write a URL by hand, and a real plus sign inside a value should be
written %2B.
If encoded text gets encoded again, the % itself becomes %25. So “flat white” turns into
flat%20white the first time and flat%2520white the second. You’ll know it when you see it:
%25 followed by two more hex digits, or a page that shows a literal “%20” where a space should be.
To read it, switch to Decode and tick Decode until clean. To fix it for good, find the step that
encodes twice. Most of the time it looks like this: the code runs encodeURIComponent on a search
term and then hands it to URLSearchParams or a request library, which encodes it a second time.
They look alike but do different jobs. URL encoding (%26) makes text safe inside a web address.
HTML entities (&) make text safe inside HTML. A link in a
page can need both: inside an href, the & between parameters is written as
&.
<a href="/search?q=coffee%20%26%20cake&page=2">Coffee and cake</a>
Base64 is something else again: it turns any data into letters and digits, for things like small images in CSS. It
isn’t a way to make a URL safe, since it uses + and / itself.
You rarely need a tool for this in code. Here’s the short version:
const q = 'coffee & cake';
const url = 'https://example.com/search?q=' + encodeURIComponent(q);
// https://example.com/search?q=coffee%20%26%20cake
// URLSearchParams builds the whole query (spaces become +)
new URLSearchParams({ q, size: 'large' }).toString();
// 'q=coffee+%26+cake&size=large'
decodeURIComponent('S%C3%A3o%20Paulo'); // 'São Paulo'
One thing to watch: decodeURIComponent throws URIError: URI malformed on a broken code like
“50% off”, so wrap it in try/catch when the text comes from users.
%E9 from an old Latin-1 page is flagged and left alone instead of
being turned into a wrong character.
& belongs to a value, only you know what you meant.A way to write characters that aren’t allowed in a web address. Each one becomes a % sign plus two hex digits for every byte it takes up, so a space is %20, & is %26 and é (two bytes in UTF-8) is %C3%A9. It’s also called percent-encoding. Letters, digits and - _ . ~ never need it.
%20 is the standard code for a space and works anywhere in a URL. The + comes from HTML forms: when a form sends data in a query string, spaces are written as +, so ?q=flat+white and ?q=flat%20white mean the same thing. In the path part of a URL a + is just a plus sign. If you’re not sure which one you need, use %20.
encodeURIComponent is for one value you’re putting into a URL, like a search term. It encodes everything that could break the URL, including / ? & = and #. encodeURI is for a whole address. It leaves those characters alone because they give the URL its shape, and only encodes spaces, accents and the like. That also means it can’t protect an & inside a value. Use encodeURIComponent on each value, then build the URL around them.
Anything that isn’t a letter, a digit or one of - _ . ~ is safe to encode. Inside a query value you must encode at least & = # + % and spaces, because they’d change what the URL means. Characters outside plain ASCII, like é, ü, € or emoji, always get encoded as their UTF-8 bytes.
The text was encoded twice. The first time a space became %20, and the second time the % itself became %25, giving %2520. Switch to Decode and tick “Decode until clean” to get the plain text back. Then look for the step that encodes twice: often a library already encodes query values and the code encoded them before passing them in.
URLs use UTF-8 today, and in UTF-8 é takes two bytes, C3 and A9. %E9 is how very old pages wrote é in the Latin-1 character set. If you decode an old link with %E9 in it, this tool tells you the code isn’t valid UTF-8 and leaves it as it was, because it can’t know for sure which old character set was meant.
JavaScript’s decodeURIComponent throws that error when the text has a broken code, like a lone % in “50% off” or a cut-off character such as %E0%A4. This tool never throws: it decodes everything it can, leaves the broken bits as they were and tells you where they are, for example “%E0%A4 at character 12 is only part of a character”.
No. Anyone can decode it. It only makes text safe to put in a link. Don’t put passwords or private data in a URL thinking the % codes hide them: links end up in browser history, server logs and screenshots.
No. Encoding and decoding happen in your browser, and nothing you paste is uploaded or saved. The page only remembers your options (Encode or Decode, the type and the checkboxes) in this browser.