URL Encode / Decode Calculator
| Character | Encoded As |
|---|
How Percent-Encoding Works
This tool uses JavaScript's built-in encodeURIComponent() and decodeURIComponent() functions, which implement the percent-encoding scheme defined by RFC 3986. Every byte outside the small set of "unreserved" characters (letters, digits, and - _ . ~) is replaced with a % followed by its two-digit hexadecimal value, and multi-byte Unicode characters are first converted to UTF-8 before each byte is encoded — so an emoji or accented letter becomes several %XX sequences, not just one. Decoding simply reverses the process, turning each %XX triplet back into its original byte and reassembling the UTF-8 sequence into a character.
Component Encoding vs. Whole-URL Encoding
This calculator encodes for use as a single URL component — a query parameter value, a path segment, a form field — which is why it also escapes characters like & = ? / : # that are structurally meaningful in a full URL. If you ran an entire URL (with its https:// scheme and slashes) through this same logic, it would mangle the URL itself. JavaScript's other function, encodeURI(), is built for that case: it leaves those structural reserved characters alone and only encodes characters that are never valid anywhere in a URL. As a rule of thumb, encode each piece of dynamic data individually with component-encoding before you assemble it into a URL, rather than building the full URL string first and encoding it afterward.
A Common Mix-Up: Encoding and Spaces
Percent-encoding always represents a space as %20. The + you often see in query strings (like ?q=hello+world) is a separate, older convention from the application/x-www-form-urlencoded format used by HTML forms — it is not something encodeURIComponent() produces or understands, so decoding form-submitted text may require converting + back to a space first. If you're troubleshooting a broken link or API request rather than encoding text, the Base64 encode/decode calculator is useful for the other common encoding scheme you'll run into, and the password generator is handy if you need a URL-safe random token to embed in a link.
Frequently Asked Questions
Why does encoding turn a space into %20 instead of a plus sign?
Percent-encoding (RFC 3986), which is what encodeURIComponent() implements, always represents a space as %20. The + sign for spaces comes from a separate, older convention used by HTML forms (application/x-www-form-urlencoded) when submitting query strings, not from standard percent-encoding itself.
Should I encode a whole URL or just parts of it?
Encode only the dynamic parts you're inserting, such as a query parameter value or path segment, before assembling the full URL. Running an entire URL through component encoding would also escape the slashes, colons, and question marks that give the URL its structure, breaking it.