- Overview
- Converters
- URL Encoder / Decoder
URL Encoder / Decoder
This URL encoder and decoder converts special characters into percent-encoded format (%XX) for safe use in URLs, and decodes encoded strings back to readable text. Paste any URL or text string to handle reserved characters, spaces, and Unicode for web development and API integration.
URL Encoder / Decoder
Encode text for safe use in URLs or decode URL-encoded strings
Frequently Asked Questions
What is URL encoding?
URL encoding, also called percent encoding, is the process of converting characters into a format that can be safely transmitted in a URL. Characters that are not allowed in URLs (like spaces, &, =, and non-ASCII characters) are replaced with a percent sign (%) followed by their two-digit hexadecimal value. For example, a space becomes %20.
Why do URLs need to be encoded?
URLs can only contain a limited set of ASCII characters. Special characters like spaces, ampersands (&), equals signs (=), and non-English characters would break URL parsing or be misinterpreted. Encoding ensures that data is transmitted correctly in query strings, form submissions, and API requests without conflicting with URL syntax delimiters.
What characters need URL encoding?
Characters that must be encoded include spaces, non-ASCII characters (like accented letters and CJK characters), and reserved characters when used as data rather than delimiters. Reserved characters include : / ? # [ ] @ ! $ & ' ( ) * + , ; =. Unreserved characters (A-Z, a-z, 0-9, -, _, ., ~) never need encoding.
What is percent encoding?
Percent encoding is the official name for URL encoding as defined in RFC 3986. Each character is converted to its UTF-8 byte sequence, and each byte is represented as %XX where XX is the hexadecimal value. For example, the Euro sign is encoded as %E2%82%AC (three UTF-8 bytes). The term 'percent encoding' comes from the % prefix used in each encoded byte.
What is the difference between encodeURI and encodeURIComponent?
In JavaScript, encodeURI() encodes a full URI but preserves characters that have special meaning in URLs (like :, /, ?, #, &). encodeURIComponent() encodes everything except unreserved characters, making it suitable for encoding individual query parameter values. Use encodeURI for complete URLs and encodeURIComponent for parameter values.
How do you decode a URL?
URL decoding reverses percent encoding by converting %XX sequences back to their original characters. In JavaScript, use decodeURI() for full URLs or decodeURIComponent() for individual components. In Python, use urllib.parse.unquote(). Most programming languages provide built-in URL decoding functions that handle UTF-8 multi-byte sequences automatically.
What is the plus sign vs %20 for spaces in URLs?
Both + and %20 represent spaces, but in different contexts. The + sign for spaces comes from the application/x-www-form-urlencoded format used in HTML form submissions. %20 is the standard percent encoding defined in RFC 3986. In URL paths, always use %20. In query strings, both are accepted, but %20 is more universally compatible across systems.
About URL Encoder / Decoder
The URL Encoder / Decoder is an essential tool for web developers that converts text into URL-safe format using percent-encoding, or decodes percent-encoded strings back to readable text. URL encoding ensures that special characters are properly transmitted in URLs without causing parsing errors or ambiguity.
What is URL Encoding?
URL encoding, also known as percent-encoding, is a mechanism for encoding characters that have special meaning in URLs or that are not allowed in URLs. Each encoded character is replaced with a percent sign (%) followed by two hexadecimal digits representing the character's byte value. For example, a space character becomes %20, and an ampersand (&) becomes %26.
How to Use the URL Encoder / Decoder
- Select the "Encode" tab to convert text to URL-safe format, or the "Decode" tab to convert back to plain text
- Type or paste your text into the input area
- The URL Encoder / Decoder converts your input instantly in real time
- View which specific characters were encoded in the breakdown
- Click the copy button to copy the result to your clipboard
Characters That Need URL Encoding
The following characters have special meanings in URLs and must be encoded when used as data values:
| Character | Encoded | Purpose in URL |
|---|---|---|
| space | %20 | Separator |
| ! | %21 | Sub-delimiter |
| # | %23 | Fragment identifier |
| $ | %24 | Sub-delimiter |
| & | %26 | Parameter separator |
| ' | %27 | Sub-delimiter |
| ( | %28 | Sub-delimiter |
| ) | %29 | Sub-delimiter |
| + | %2B | Space (in forms) |
| / | %2F | Path separator |
| : | %3A | Scheme separator |
| = | %3D | Key-value separator |
| ? | %3F | Query string start |
| @ | %40 | User info separator |
Common Use Cases for URL Encoding
- Encoding query string parameters that contain special characters
- Preparing user-submitted data for inclusion in URLs
- Encoding file paths with spaces or special characters
- Building API request URLs with dynamic parameters
- Encoding redirect URLs passed as parameters
- Handling internationalized domain names and paths with non-ASCII characters
encodeURIComponent vs encodeURI
This URL Encoder / Decoder uses encodeURIComponent(), which encodes all characters that are not unreserved (letters, digits, hyphens, periods, underscores, and tildes). This is the appropriate function for encoding individual URL components like query parameter values. The alternative, encodeURI(), is designed for encoding entire URIs and preserves characters like :, /, ?, and # that have structural meaning in URLs.
Tips for URL Encoding
- Always encode user input before including it in URLs to prevent injection attacks
- Use
encodeURIComponent()for query parameter values, not for entire URLs - Remember that spaces can be encoded as
%20or+depending on the context - Double-encoding (encoding an already-encoded string) can cause issues — always decode before re-encoding
- Unicode characters are first converted to UTF-8 bytes, then each byte is percent-encoded