URL Encoder/Decoder
Encode text to URL format and decode URL-encoded strings β supports all special characters and Unicode.
Output will appear here
Start typing to see live output
All encoding/decoding happens locally in your browser β your data never leaves your device.
Percent-encoding, usually called URL encoding, replaces characters that are reserved or unsafe in a URL with a % sign followed by two hex digits for each UTF-8 byte: a space becomes %20 and & becomes %26. This tool encodes text with JavaScript's encodeURIComponent and decodes it with decodeURIComponent.
encodeURIComponent is designed for a single URL component, such as a query parameter value or a path segment. It encodes everything except AβZ, aβz, 0β9 and - _ . ! ~ * ' ( ). Because it also encodes : / ? # & and =, encoding a whole URL gives you a string you can nest inside another URL (a redirect parameter, for example), not a working link.
For binary data or tokens in URLs, URL-safe Base64 is often more compact. If the text is going into an HTML page rather than a URL, use HTML escaping instead; the two are not interchangeable.
- Choose Encode or Decode. Switching modes clears the input.
- Type or paste your text into the input panel. The result updates as you type.
- When building a query string, encode each value on its own, then join the pairs with = and & yourself.
- Copy the output, or click Swap to move it into the input and check that it decodes back to the original.
- Encoding with encodeURIComponent, suited to query values and path segments
- Decoding of %XX sequences, including multi-byte UTF-8 characters such as emoji
- Live output with character counts for input and output
- Swap button to test a round trip in one click
- Error message for malformed percent sequences instead of silent corruption
- Runs in the browser; input is not uploaded
Encoding punctuation and spaces
Input: Hello, World! Output: Hello%2C%20World!
The comma and space are encoded. ! belongs to the set that encodeURIComponent leaves unchanged.
Encoding an emoji
Input: π Rocket Output: %F0%9F%9A%80%20Rocket
The rocket emoji is 4 bytes in UTF-8, so it becomes four %XX sequences.
A value containing + = and &
Input: a+b=c & d Output: a%2Bb%3Dc%20%26%20d
Left unencoded, a server would read + as a space and split the value at = and &.
Passing a URL as a parameter
Input: https://example.com/search?q=cafΓ© au lait&page=2 Output: https%3A%2F%2Fexample.com%2Fsearch%3Fq%3Dcaf%C3%A9%20au%20lait%26page%3D2
Every reserved character is encoded, so the whole URL can be sent as ?redirect=... without breaking the outer URL.
Invalid URL encoding β check your input for malformed %XX sequences.
A % is not followed by two hex digits (as in 100% or %2), or the bytes do not form valid UTF-8. %E9 on its own, a Latin-1 encoding of Γ©, is one such case.
Write a literal percent sign as %25. If the data came from a system using Latin-1, convert it to UTF-8 before decoding.
%2520 appears where %20 was expected
The value was encoded twice: the % from the first pass was itself encoded as %25.
Decode once more to get back to single encoding, and make sure your code encodes the raw value only once.
Plus signs are still there after decoding
The input is form-encoded, where + means a space. decodeURIComponent does not apply that rule.
Replace + with %20 first, then decode.
The encoded URL no longer opens in a browser
The scheme and path separators (:// and /) were encoded along with everything else.
Encode only individual parameter values, not the whole URL.
Why does the tool use %20 for spaces instead of +?
The + convention belongs to application/x-www-form-urlencoded, the format HTML forms and URLSearchParams use for query strings. encodeURIComponent always produces %20, which is valid in both paths and query strings.
Why are ! ' ( ) and * not encoded?
encodeURIComponent treats them as safe and leaves them as they are. RFC 3986 lists them as reserved sub-delimiters, so a few strict systems (OAuth 1.0 signatures, for example) require them encoded. In that case, replace them with %21, %27, %28, %29 and %2A after encoding.
Does decoding turn + into a space?
No. decodeURIComponent leaves + unchanged. If you are decoding form data, replace each + with %20 before pasting it in.
Can I encode a complete URL so it stays clickable?
Not with this tool. It encodes : and / as well, which is what you want for a nested URL but not for a link. To make a link safe, encode only the parts that need it, such as each query value. Decoding a complete URL works fine.
How are accented letters and other non-ASCII characters encoded?
They are converted to UTF-8 first and each byte is written as %XX. For example, Γ© is two bytes and becomes %C3%A9.
- Base64 EncoderEncode and decode Base64 strings instantly β supports text and URL-safe mode.
- HTML Escape/UnescapeEscape and unescape HTML strings β convert special characters to/from entities safely.
- JSON Escape/UnescapeEscape and unescape JSON strings β ensure valid JSON formatting with proper character escaping.
- XML Escape/UnescapeEscape and unescape XML strings β properly encode special characters for XML documents.
- JavaScript Escape/UnescapeEscape and unescape JavaScript strings β convert special characters to escape sequences.
- Java Escape/UnescapeEscape and unescape Java strings β generate Java-safe escaped strings with proper Unicode support.