πURL Encoder/Decoder
Encode and decode URL strings for safe transmission
β
encodeURIComponent encodes all special characters including /?:@&=+$,# while encodeURI preserves URL structure characters.
0 characters
0 characters
π‘About URL Encoding
URL encoding converts characters into a format that can be safely transmitted over the Internet. It replaces unsafe characters with a '%' followed by two hexadecimal digits.
When to Use URL Encoding
- Including special characters in URL query parameters
- Sending data with non-ASCII characters
- Preventing URL injection attacks
- Processing form submission data
Encoding Type Differences
Function | Encodes | Preserves | Usage |
---|---|---|---|
encodeURI | Non-URL syntax characters | / ? : @ & = + $ , # | Encoding complete URLs |
encodeURIComponent | All special characters | - _ . ! ~ * ' ( ) | Encoding URL parameters |
Examples
Original: https://example.com/path?name=John Doe&age=30
encodeURI: https://example.com/path?name=John%20Doe&age=30
encodeURIComponent: https%3A%2F%2Fexample.com%2Fpath%3Fname%3DJohn%20Doe%26age%3D30