URL Encoder / Decoder
URLs can only safely contain a specific set of ASCII characters. Anything outside that set — spaces, quotes, curly braces, emoji, non-Latin characters — must be percent-encoded (converted to %XX hex notation). This tool handles both directions: encode plain text for safe URL use, or decode a percent-encoded URL back to readable text.
Why Percent-Encoding Exists
The original URL specification (RFC 1738, later refined by RFC 3986) restricts the unreserved character set to letters, digits, and a small handful of punctuation: -._~. Reserved characters like ?, #, &, /, and = have structural meaning — they delimit the URL's parts. Anything else has to be encoded as the byte's hex value prefixed with a percent sign. A space becomes %20, an emoji becomes a multi-byte UTF-8 sequence like %F0%9F%8E%89, and a Chinese character becomes a three-byte sequence.
The split between unreserved, reserved, and to-be-encoded is the source of most URL bugs. A search query containing a + is a real example: RFC 3986 lists it as a reserved sub-delimiter that a path may contain literally, while in a form-encoded query string + is interpreted as a space by historical convention. This is why encodeURIComponent encodes + but encodeURI doesn't.
Component vs Whole URI Encoding
Component mode (encodeURIComponent) escapes everything except a small safe set. Use it for individual URL parts like query string values, path segments, or fragment identifiers — anything you're inserting into a URL you're building. Whole URI mode (encodeURI) leaves structural characters (:/?#[]@!$&'()*+,;=) alone. Use it when you have a complete, already-structured URL that just needs its non-ASCII characters escaped.
The decoder reverses both. It accepts a percent-encoded string, parses each %XX sequence as a byte, decodes the byte stream as UTF-8, and returns the result. Malformed sequences (a lone % or invalid hex digits) get reported rather than silently producing garbage.
Common Use Cases
Building a query string by hand when your HTTP library is being uncooperative. Reading a URL from a log file or analytics export where everything has been encoded twice (run the decoder twice). Debugging why a link with an apostrophe in the path is breaking — the answer is almost always that someone forgot to encode it. Pair with the JSON formatter when the encoded URL was part of a JSON-encoded API response, and with the HTML entity encoder when a URL appears inside HTML attribute values.
Worked example: the same text, three encoders
The tool calls the browser's own encodeURIComponent (Component) or encodeURI (Whole URI), and the matching decode functions. On October 12, 2026 we ran six strings through both in Node and compared them with URLSearchParams, which is how browsers build form-style query strings.
| Input | Component | Whole URI | URLSearchParams (form) |
|---|---|---|---|
café & crème | caf%C3%A9%20%26%20cr%C3%A8me | caf%C3%A9%20&%20cr%C3%A8me | caf%C3%A9+%26+cr%C3%A8me |
a+b c/d?x=1#f | a%2Bb%20c%2Fd%3Fx%3D1%23f | a+b%20c/d?x=1#f | a%2Bb+c%2Fd%3Fx%3D1%23f |
!*'()~ | !*'()~ (unchanged) | !*'()~ | %21*%27%28%29%7E |
100% sure | 100%25%20sure | 100%25%20sure | 100%25+sure |
| 🎉 (1 emoji, 4 UTF-8 bytes) | %F0%9F%8E%89 (12 chars) | same | same |
| 🇯🇵 (flag = 2 code points) | %F0%9F%87%AF%F0%9F%87%B5 (24 chars) | same | same |
- Component is right for one value; Whole URI is not. Whole URI mode leaves
&,/,?,#and+alone, so "café & crème" pasted into?q=would split into two parameters. Use Component for anything you insert into a URL. - Five characters are left as typed.
! * ' ( )pass through Component mode. RFC 3986 reserves them, so a strict server or an OAuth signature base string expects them encoded; MDN gives a one-line replace for that case. Form encoding (URLSearchParams) does encode them, except*. - A plus sign is not a space here. Decoding
a+b%20cgives "a+b c": the decode functions only reverse percent sequences. Form-encoded query strings use + for spaces, so decode those withURLSearchParams(which gives "a b c") or replace + with %20 first. - Whole URI decode keeps reserved characters encoded.
a%26b%2Fc%20ddecodes toa%26b%2Fc din Whole URI mode and to "a&b/c d" in Component mode, because decodeURI will not turn %26 or %2F back into characters that would change the URL's structure. - Errors instead of garbage. A stray
%(as in "100% sure") makes decoding fail with "URI malformed", and so does encoding a lone surrogate. The tool shows the error rather than guessing.
Sources
Checked on .
Frequently Asked Questions
Built by Derek Giordano · Part of Ultimate Design Tools