URL Encoder / Decoder Calculator
Percent-encode text for safe use in URLs, or decode a percent-encoded string back to readable text — using the browser’s own encodeURIComponent.
How it works
encode: each unsafe byte → "%" + two-digit uppercase hex of its UTF-8 value (encodeURIComponent) · decode: reverse each "%HH" back to a byte, then UTF-8 → text
URLs may only contain a limited set of ASCII characters, so anything else — spaces, "&", "=", "?", accented letters, emoji — must be percent-encoded before it goes into a query string or path segment. Encoding replaces each unsafe byte with a "%" followed by its two-digit hexadecimal value; multibyte UTF-8 characters produce several escapes in a row. This tool uses encodeURIComponent, which escapes the URL-reserved delimiters too, making it the right choice for a single value like one query parameter. Decoding fails on a malformed "%" sequence, which the tool reports rather than returning garbage.
Worked example
Encoding "name=John Doe & city=São Paulo" replaces the spaces with %20, the "=" with %3D, the "&" with %26 and the "ã" with its two UTF-8 bytes %C3%A3, giving "name%3DJohn%20Doe%20%26%20city%3DS%C3%A3o%20Paulo". Decoding that string reverses every escape back to the original text.
Sources: encodeURIComponent() — MDN
Frequently asked questions
What is the difference between encodeURIComponent and encodeURI?
encodeURI is for a whole URL and deliberately leaves the structural characters (: / ? & = #) intact so the address still works. encodeURIComponent is for a single piece that goes inside a URL — one query value or path segment — so it also escapes those delimiters. Use encodeURIComponent (what this tool does) when the text itself might contain a "&" or "=" you do not want treated as URL syntax.
Why does one accented letter become several % codes?
Characters outside ASCII are first turned into UTF-8, which uses two to four bytes each, and every byte becomes its own "%HH" escape. So "ã" becomes %C3%A3 and an emoji can become four escapes — that is expected, not an error.
When does decoding fail?
A "%" must be followed by exactly two hexadecimal digits. A stray "%" or a sequence like "%zz" or "%2" is malformed, and decoding throws — this tool catches that and reports an invalid string instead of guessing.
Related calculators
This calculator is for educational purposes. Double-check important results before acting on them.