URL Encoding Explained
URL encoding (percent encoding) converts characters not allowed in URLs into a safe format using a % followed by two hexadecimal digits. For example, a space becomes %20, & becomes %26. This is essential when passing special characters in query strings or path segments.
When should I encode a URL?
Encode URLs when passing them as query parameters in another URL, when building HTTP requests programmatically, or when storing URLs in databases or JSON.
What is the difference between encodeURI and encodeURIComponent?
encodeURI encodes a full URL, preserving ://?=& characters. encodeURIComponent encodes a URL component (like a query value), encoding those characters too. This tool uses both modes.