URL Encode/Decode
🔒 In your browserPercent-encode/decode with the right scope, live — plus double-encoding detection.
How it works
URLs may only contain a limited set of characters, so anything else is percent-encoded — a space becomes %20, an & becomes %26. Pick the right scope:
- Component (
encodeURIComponent) — for a single value like one query parameter. Escapes/ ? & = #too. This is what you want 90% of the time. - Whole URL (
encodeURI) — for a complete URL. Leaves/ ? & = #alone so the URL still works.
Using the wrong one is the #1 URL bug: encode a whole URL as a “component” and it breaks; encode a value as a “whole URL” and an & inside it splits your parameters.
Try an example
hello%20world%20%26%20more%3Dyes
Character reference (RFC 3986)
Never encoded (unreserved): A–Z a–z 0–9 - _ . ~
| Char | Encoded | Meaning in a URL |
|---|---|---|
| / | %2F | Path separator |
| ? | %3F | Starts the query string |
| # | %23 | Starts the fragment |
| & | %26 | Separates query parameters |
| = | %3D | Separates a key from its value |
| + | %2B | Means a space in query strings |
| (space) | %20 | Space |
| : | %3A | After the scheme / before a port |
| @ | %40 | Separates userinfo from host |
| % | %25 | Starts an escape sequence |
About the URL Encode/Decode
URLs can only contain a limited set of characters, so spaces, ampersands, accents and symbols must be percent-encoded. This free URL encoder and decoder does it correctly with a live preview, picking the right scope (encodeURI vs encodeURIComponent) and flagging double-encoding.
It runs entirely in your browser, keeping your data private.
How to URL-encode and decode
- Paste text or a URL to encode it, or an encoded string to decode it.
- Choose whole-URL scope or component scope (for a single query value).
- Double-encoding is detected and flagged so you don't corrupt your links.
encodeURI vs encodeURIComponent
The two differ in scope. encodeURIComponent encodes a single value — a query parameter or path segment — and escapes reserved characters like &, ? and / that would otherwise break the URL structure. encodeURI encodes a whole URL and deliberately leaves those structural characters intact. Using the wrong one either corrupts a valid URL or fails to protect a value; this tool picks the right scope for you.
Frequently asked questions
What is URL encoding?
URL (percent) encoding replaces characters that aren't allowed in a URL — like spaces, &, ? and non-ASCII characters — with a % followed by their hex code, so the URL stays valid.
What's the difference between encodeURI and encodeURIComponent?
encodeURI encodes a whole URL and leaves characters like / and ? intact, while encodeURIComponent encodes a single component (such as a query value) and escapes those characters too.
What is double-encoding?
Encoding an already-encoded string, which turns % into %25 and breaks the link. This tool detects and warns about it.
What is double-encoding?
Encoding an already-encoded string, which turns % into %25 and breaks the link. This tool detects and warns about it so you don't accidentally encode twice.
Related searches
Learn more
Related Developer tools
🔗 Embed this tool on your website — free
Copy this and paste it into your page's HTML. The tool runs in the visitor's browser, just like here. Change height to fit, or add the optional auto-resize snippet below. Add ?theme=dark to the URL for dark mode.
<iframe src="https://toolhq.dev/embed/url-encode/" title="URL Encode/Decode — ToolsHub" width="100%" height="520" style="border:1px solid #e5e7eb;border-radius:12px;max-width:680px" loading="lazy"></iframe>Optional: auto-resize the iframe height
Add this once on the same page so the iframe grows to fit the tool:
<script>
addEventListener("message", function (e) {
if (e.data && e.data.type === "toolshub:resize") {
document.querySelectorAll('iframe[src*="/embed/"]').forEach(function (f) {
if (f.contentWindow === e.source) f.style.height = e.data.height + "px";
});
}
});
</script>