What is URL Encoding?
URL encoding (also called percent-encoding) converts characters that are not allowed in URLs into a format that can be transmitted safely. Special characters like spaces, &, =, ?, #, and non-ASCII characters are replaced with a % sign followed by their hexadecimal code.
For example, a space becomes %20, an ampersand becomes %26, and an @ symbol becomes %40. This is essential for correctly passing data in query strings, form submissions, and API requests.
When Do You Need URL Encoding?
- Passing special characters in query parameters (e.g., search terms with & or =)
- Encoding form data for HTTP POST requests
- Building API request URLs with dynamic parameters
- Sharing URLs that contain non-ASCII characters (accented letters, CJK characters)
- Embedding URLs inside other URLs
What's the difference between encodeURI and encodeURIComponent? ▼
encodeURI encodes an entire URL, leaving characters like /, :, ?, # intact since they have structural meaning. encodeURIComponent encodes everything including those characters — use it for individual query parameter values. This tool uses encodeURIComponent-style encoding.
Why is a space sometimes shown as + instead of %20? ▼
HTML form submissions use application/x-www-form-urlencoded format which encodes spaces as +. Standard percent-encoding uses %20. Both are valid in different contexts — %20 in URL paths, + in query strings submitted by forms.