URL Encoder / Decoder
Encode special characters in URLs for safe transmission and decode percent-encoded strings back to readable text. Supports both encodeURIComponent and full URI encoding.
URL encoding (percent encoding) replaces characters that are not allowed in URLs with a % followed by two hex digits. For example, a space becomes %20 and & becomes %26. You need this when passing special characters in query parameters to avoid breaking the URL structure.
Frequently Asked Questions
What is the difference between encodeURI and encodeURIComponent?
encodeURI encodes a full URL, preserving structural characters like /, ?, and #. encodeURIComponent encodes individual components like query parameter values, converting those characters too.
When do I need to URL-encode a string?
When placing user-provided text into a URL query parameter — e.g., a search query that might contain &, =, +, or spaces. Without encoding these characters would break the URL structure.
What characters are safe in a URL without encoding?
Unreserved characters (A–Z, a–z, 0–9, -, _, ., ~) are always safe. Structural characters like /, ?, #, =, and & have special meaning and must be encoded when used as data.
Why does + sometimes appear instead of %20?
In HTML form encoding (application/x-www-form-urlencoded), spaces are encoded as +. In standard percent-encoding, spaces are %20. Most web servers accept both in query strings.