Text to encode:
Encoded result:
Encoding Settings:
About URL Encoding/Decoding
How to use:
- Choose between Encode or Decode in the tabs
- Select the appropriate encoding/decoding function for your needs
- Enter your text in the input editor
- Click the Encode/Decode button to process your text
- Copy the results from the output editor
encodeURI
Designed for encoding complete URLs. It preserves characters that are part of URI structure:
: / ? # [ ] @ ! $ & ' ( ) * + , ; =
Example:
Original: https://example.com?q=hello world
Encoded: https://example.com?q=hello%20world
encodeURIComponent
Designed for encoding URL components (like query parameters). Encodes all special characters.
Example:
Original: hello world&category=tools
Encoded: hello%20world%26category%3Dtools
Use encodeURIComponent for:
- Query string parameters
- Path segments containing special characters
- Any part of a URL that might contain reserved characters
- Form data values
Use encodeURI for:
- Complete URLs
- When you want to preserve URL structure
- When you need to maintain reserved characters
Tip: When in doubt, use encodeURIComponent for individual components and encodeURI for complete URLs.
Character Encoding Details:
URL encoding converts characters into a format that can be transmitted over the Internet. It replaces unsafe ASCII characters with a "%" followed by two hexadecimal digits. Both encodeURI and encodeURIComponent use UTF-8 encoding for non-ASCII characters, ensuring proper handling of international characters and symbols.
Space character
Encoded as %20
(not as +)
Non-ASCII characters
Encoded as UTF-8 byte sequences (multiple %XX values)
Reserved characters
E.g., & = ?
have special meanings in URLs