URL Encoder / Decoder
This tool encodes special characters in text to percent-encoded URL format and decodes percent-encoded strings back to plain text, all in your browser.
What is URL Encoder / Decoder?
URL encoding (also called percent-encoding) converts characters that are not allowed in a URL into a safe format. Characters like spaces, ampersands, and hash symbols carry special meaning in URLs, so they must be encoded as a percent sign followed by their two-digit hexadecimal ASCII code (e.g., a space becomes %20, & becomes %26). RFC 3986 defines the official URL character set. JavaScript provides two functions: encodeURIComponent() encodes everything except unreserved characters (A–Z, a–z, 0–9, -, _, ., ~), while encodeURI() preserves characters with structural URL meaning (like / and :) — a critical distinction that trips up even experienced developers.
How to use URL Encoder / Decoder
- Paste plain text or a URL string into the input field.
- Click 'Encode' to convert it to percent-encoded URL format.
- Or click 'Decode' to convert a percent-encoded string back to plain text.
- The result appears instantly in the output field below.
- Click 'Copy' to copy the encoded or decoded result to your clipboard.
URL Encoder / Decoder Example
https://example.com/search?q=hello world&lang=en
https%3A%2F%2Fexample.com%2Fsearch%3Fq%3Dhello%20world%26lang%3Den
Frequently Asked Questions
What is the difference between encodeURI and encodeURIComponent?
encodeURI() encodes a complete URL, preserving structural characters like '/', ':', '?', '&', and '#'. encodeURIComponent() encodes a URI *component* (like a query value), converting those structural characters too. Use encodeURIComponent() for query parameter values.
Why does a space become %20 in URLs?
Spaces are not allowed in URLs per RFC 3986. %20 is the percent-encoding of the ASCII code for space (decimal 32, hex 20). Some systems also use '+' for spaces in query strings (application/x-www-form-urlencoded format), which is slightly different.
My encoded URL looks wrong — some characters aren't encoded. Why?
Unreserved characters (A–Z, a–z, 0–9, -, _, ., ~) are never encoded because they are safe in any URL context. This is correct behavior per the specification.
Can I decode a broken or truncated URL?
You can decode partial URLs. The decoder processes each valid %XX sequence it finds and leaves any malformed sequences as-is, so truncated input is handled gracefully.
Is URL encoding the same as Base64 encoding?
No. URL encoding replaces unsafe characters with %XX sequences and is still human-readable. Base64 transforms binary data into a 64-character alphanumeric format that is no longer human-readable, and is used for data transmission, not URL safety.