Paste text or a URL component below to instantly encode or decode it. Everything runs in your browser — nothing you enter here is uploaded, stored, or logged.
Your text is processed locally in your browser and is not uploaded to our server.
What is URL Encoding?
URL encoding (also called percent-encoding) converts characters that aren’t safe inside a URL — spaces, &, ?, =, and others — into a % followed by two hexadecimal digits. This lets arbitrary text, including another URL’s own special characters, travel safely inside a single URL component such as a query parameter.
How URL Encoding Works
Each unsafe byte is replaced with % plus its two-digit hexadecimal value — a space becomes %20, an ampersand becomes %26. Letters, digits, and a small set of punctuation marks (- _ . ~) are left alone because they’re already safe everywhere in a URL. Non-ASCII text, including Unicode characters, is first converted to UTF-8 bytes and then each byte is percent-encoded.
URL Encoding vs URL Decoding
Encoding turns readable text into a URL-safe form — you’d do this before putting user-supplied text into a query string or path segment. Decoding reverses that process, turning percent-encoded text back into its original, readable form — useful when reading values out of an incoming URL. This tool does both, using the same reversible algorithm in each direction.
encodeURIComponent() vs encodeURI()
JavaScript provides two related functions, and mixing them up is a common source of bugs. encodeURIComponent() — what this tool uses — encodes every character that isn’t safe inside a single URL component, including & ? = / : #, because those characters would otherwise be misread as URL structure rather than data. encodeURI() encodes less: it assumes you’re passing in an entire URL and leaves structural characters like : / ? & = untouched. Use encodeURIComponent() for a query parameter, form value, or path segment; only reach for encodeURI() when you already have a complete, valid URL you want to lightly clean up.
Common URL Encoding Mistakes
- Encoding an entire URL with
encodeURIComponent()— this also encodes the://and slashes, breaking the URL structure. Only encode the individual values going into it. - Double encoding — encoding an already-encoded string turns
%20into%2520. Decode first if you’re not sure of the current state. - Manually replacing spaces with
+— that convention is specific to form submissions (application/x-www-form-urlencoded), not general URL encoding. - Decoding malformed input — a stray
%not followed by two valid hex digits will fail to decode; this tool reports that clearly instead of crashing.
FAQ
Is my text uploaded anywhere?
No. Encoding and decoding both happen locally in your browser using JavaScript’s built-in encodeURIComponent() and decodeURIComponent(). Your input is never sent to our server.
Why did decoding fail?
Decoding fails when the input contains a % that isn’t followed by two valid hexadecimal digits, or an incomplete multi-byte sequence. Check the Common URL Encoding Mistakes section above.
What does Swap do?
Swap exchanges the input and result fields as-is, without re-processing either value — handy for quickly reversing direction after an encode or decode.
Do I need an account?
No. The tool is free to use and doesn’t require sign-up.