What Is URL Encoding?
URL encoding (also called percent-encoding) converts special characters in a URL into a format that can be transmitted over the Internet. Characters are replaced with a "%" followed by their hexadecimal value.
encodeURI vs encodeURIComponent
- encodeURI: Encodes a full URI but preserves characters that have special meaning in URLs (: / ? # [ ] @ ! $ & ' ( ) * + , ; =).
- encodeURIComponent: Encodes everything except A-Z, a-z, 0-9, - _ . ~. Use this for encoding query parameter values.
When to Use Each
- Use encodeURI when encoding a complete URL and you want to keep the structure intact.
- Use encodeURIComponent when encoding a value that will be placed in a query string parameter.
Frequently Asked Questions
Does this tool support Unicode?
Yes. Unicode characters (including Japanese, emoji, etc.) are properly encoded using UTF-8 percent-encoding.
Is URL encoding the same as Base64?
No. URL encoding replaces unsafe characters with percent-encoded equivalents, while Base64 converts binary data into a text representation using 64 characters.