Understanding URL Encoding
URLs can only contain a limited set of characters from the ASCII character set. When you need to include characters outside this set—like spaces, international characters, or reserved symbols—they must be encoded using percent-encoding (also called URL encoding).
Each character is converted to its UTF-8 byte representation, then each byte is written as %XX where XX is the hexadecimal value. For example, the space character (ASCII 32) becomes %20, and the Japanese character あ becomes %E3%81%82.
How to Use This Tool
- Select Encode or Decode mode
- Choose Component (for query params) or Full URL encoding
- Paste your text or upload a file
- Enable 'Per Line' for batch processing
- Click process and copy or download results
Component vs Full URL Encoding
Component Encoding (encodeURIComponent)
This mode encodes all characters except: A-Z, a-z, 0-9, and - _ . ! ~ * ' ( ). It's designed for encoding individual components like query parameter values.
Example:
Input: name=John Doe&city=New York
Output: name%3DJohn%20Doe%26city%3DNew%20York
Notice how = and & are encoded because they have special meaning in query strings. Use this when the value might contain these characters.
Full URL Encoding (encodeURI)
This mode preserves URL structure characters: : / ? # [ ] @ ! $ & ' ( ) * + , ; =. It only encodes characters that are invalid anywhere in a URL.
Example:
Input: https://example.com/path?name=John Doe
Output: https://example.com/path?name=John%20Doe
The URL structure (://@?=) is preserved, only the space is encoded.
Common Use Cases
Building Query Strings
When constructing URLs programmatically, you need to encode parameter values to handle special characters. For a search query like "cats & dogs":
?q=cats & dogs- Broken (& starts new parameter)?q=cats%20%26%20dogs- Correct (component encoded)
API Requests
REST APIs often require URL-encoded data, especially for form submissions or query parameters. Our tool helps you properly encode values before including them in API calls.
Debugging URL Issues
When URLs aren't working as expected, it's often due to encoding issues. Decode the URL to see the actual values being passed, then re-encode properly using the correct mode.
International Characters
URLs with non-ASCII characters (like Chinese, Arabic, or emoji) must be percent-encoded for compatibility. Our tool handles UTF-8 encoding automatically, converting international text to valid URL format.
Reserved Characters Reference
These characters have special meaning in URLs:
:- Separates scheme from path, host from port/- Path segment separator?- Starts query string#- Starts fragment identifier[]- IPv6 address literals@- Separates user info from host&- Query parameter separator=- Key-value separator in query strings
Batch Processing
Enable "Process Per Line" to encode or decode multiple values at once. This is useful for:
- Processing lists of query parameter values
- Encoding/decoding URL lists from log files
- Batch converting file names for URL use
- Processing exported spreadsheet data
Technical Notes
Our tool uses JavaScript's native encodeURIComponent() and encodeURI() functions, ensuring standard-compliant encoding. Key behaviors:
- Full Unicode support via UTF-8 encoding
- Handles malformed percent-encoded sequences gracefully
- Processes files in chunks for large inputs
- Invalid decode inputs are preserved as-is in per-line mode
Frequently Asked Questions
What is URL encoding?
URL encoding (also called percent-encoding) converts characters that aren't allowed in URLs into a format that can be safely transmitted. Special characters are replaced with '%' followed by their hexadecimal ASCII value. For example, a space becomes '%20' or '+' depending on the context.
What's the difference between Component and Full URL encoding?
Component encoding (encodeURIComponent) encodes all special characters including /:?#@. Use it for query parameter values. Full URL encoding (encodeURI) preserves URL structure characters, encoding only characters that aren't valid anywhere in a URL. Use it when encoding complete URLs.
When should I use URL encoding?
Use URL encoding when: passing data in query strings, including special characters in path segments, encoding form data for submission, constructing URLs programmatically, or working with international characters in URLs.
Why do some characters not get encoded?
In Full URL mode, characters that are valid in URLs (like :, /, ?, #, @) are preserved to maintain URL structure. In Component mode, these are encoded because they could interfere with URL parsing when used in query values.
Can I process multiple URLs at once?
Yes! Enable 'Process Per Line' to encode or decode each line separately. This is perfect for batch processing URL lists or query parameter values. Each line is processed independently.