URL Encoder / Decoder
Percent-encode special characters to make URLs safe for transmission, or decode percent-encoded strings back to readable text. Choose between encodeURIComponent (component) or encodeURI (full URL) encoding modes.
What is URL Encoding?
URL encoding (also called percent-encoding) converts characters that are not allowed in a URL into a safe format by replacing them with a % sign followed by two hexadecimal digits representing the character's UTF-8 byte value. For example, a space becomes %20, and & becomes %26.
URLs can only contain a limited set of characters from the ASCII character set. Any other characters — including spaces, Unicode characters, and special symbols — must be percent-encoded before being included in a URL.
Component vs Full URL Encoding
JavaScript provides two encoding functions that behave differently:
- encodeURIComponent() — encodes every character except
A-Z a-z 0-9 - _ . ! ~ * ' ( ). Use this for query parameter values, form data, and any part of a URL that could contain special characters. - encodeURI() — encodes everything except the characters legal in a URI, preserving the structural characters
/ ? & = # @ : ;. Use this when encoding a complete URL that already has its structure in place.
Frequently Asked Questions
%20 is the standard percent-encoding for a space and works everywhere. The + sign is only valid as a space in the application/x-www-form-urlencoded format used by HTML form submissions — it should not be used in path segments or general URIs./, ?, &, = and other structural characters.%F0%9F%9A%80. Modern browsers typically display the decoded characters in the address bar for readability, but the underlying URL uses the percent-encoded form.