URL Encoder / Decoder
What is URL Encoding?
URL encoding (percent-encoding) replaces unsafe characters with a "%" followed by their hexadecimal representation. This ensures URLs are transmitted correctly over the internet, as URLs can only contain ASCII characters.
When to Use URL Encoding
- Query parameters with spaces or special characters
- File names with non-ASCII characters
- Form data submitted via GET method
- API requests with special characters
Encode vs encodeURIComponent
encodeURI encodes a full URI, preserving characters like :, /, ?, #, &. encodeURIComponent encodes everything except letters, digits, and - _ . ~, making it suitable for encoding individual query parameter values.