URL Encoder / Decoder
Encode special characters for use in URLs, or decode percent-encoded strings back to readable text. Instant results.
🔗 URL Encoding Tool
Quick Reference — Common URL Encodings
| Character | Encoded | Description |
|---|---|---|
| Space | %20 | Space character |
| ! | %21 | Exclamation mark |
| # | %23 | Hash / fragment |
| $ | %24 | Dollar sign |
| & | %26 | Ampersand |
| + | %2B | Plus sign |
| / | %2F | Forward slash |
| = | %3D | Equals sign |
| ? | %3F | Question mark |
| @ | %40 | At sign |
What is URL Encoding?
URL encoding (also called percent encoding) is a mechanism for converting special characters into a format that can be safely transmitted in a URL. URLs can only contain a limited set of characters from the ASCII character set. Characters outside this set — including spaces, quotes, and non-ASCII characters — must be replaced with a percent sign (%) followed by two hexadecimal digits representing the character's byte value.
For example, a space is encoded as %20, an ampersand as %26, and the Japanese character “あ” as %E3%81%82.
encodeURI vs encodeURIComponent
JavaScript provides two functions for URL encoding with different behaviors:
encodeURI() encodes a complete URL while preserving characters that have special meaning in URLs: :// / ? = & # @. Use this when encoding a full URL and you want to keep its structure intact.
encodeURIComponent() encodes everything including ? = & /. Use this when encoding a single query parameter value or any string that will be inserted into a URL. This is the safer choice for encoding user input.
Example: For the URL https://example.com/search?q=hello world:
encodeURI() → https://example.com/search?q=hello%20world (preserves structure)
encodeURIComponent() → https%3A%2F%2Fexample.com%2Fsearch%3Fq%3Dhello%20world (encodes everything)
Common URL Encoding Examples
Space → %20: Spaces are the most commonly encoded character. In form submissions, spaces may also appear as +.
& → %26: The ampersand separates query parameters. If your data contains a literal &, it must be encoded to avoid being interpreted as a separator.
= → %3D: The equals sign separates keys from values in query strings. Encode it if it appears in data values.
/ → %2F: Forward slashes are path separators. Encode them in parameter values to avoid breaking the URL path structure.
Frequently Asked Questions
- What is URL encoding?
- URL encoding replaces special characters with
%followed by two hex digits. This ensures URLs are valid, as only certain ASCII characters are allowed in URLs. - How do I encode a URL online?
- Paste your text above and click Encode. Use Full URL mode to preserve URL structure, or Component mode to encode everything including special URL characters.
- What does %20 mean in a URL?
- %20 is the percent-encoded representation of a space character. URLs cannot contain literal spaces, so they must be encoded as %20.
- How do I decode a URL?
- Paste the percent-encoded URL and click Decode. All
%XXsequences will be converted back to their original characters. - What characters need to be encoded in a URL?
- Spaces, quotes, angle brackets, curly braces, pipe, backslash, and non-ASCII characters. Also
? = & #when used as data values rather than URL structure.