URL Encode / Decode
Encode strings for safe use in URLs and decode percent-encoded URL strings back to readable text.
Encoded output
Decoded output
About URL Encoding
URL encoding (also called percent-encoding) is a method for encoding special characters in URLs so they can be safely transmitted. Characters that have special meaning in URLs — like &, =, ?, #, and spaces — are replaced with a % followed by two hexadecimal digits representing the character's ASCII or UTF-8 value.
Reserved vs unreserved characters
- Unreserved characters — Letters (A–Z, a–z), digits (0–9), and
-,_,.,~are safe in URLs and do not need encoding. - Reserved characters — Characters like
:,/,?,#,[,],@,!,$,&,',(,),*,+,,,;,=have special meaning in URLs and must be encoded if used as data.
Examples
- Space →
%20(or+in form data) &→%26=→%3D@→%40- ü →
%C3%BC(multi-byte UTF-8)
encodeURIComponent vs encodeURI
In JavaScript, encodeURIComponent() encodes a value to be used as a query parameter or path segment — it encodes all reserved characters. encodeURI() encodes a complete URL and does not encode characters that are valid URL structure characters (like / and ?). Use encodeURIComponent() when encoding individual values to embed in a URL.
Frequently asked questions
What is URL encoding?
URL encoding (percent encoding) converts special characters into a % followed by two hex digits. For example, a space becomes %20 and & becomes %26. This ensures URLs are valid and unambiguous.
What is the difference between encodeURI and encodeURIComponent?
encodeURI encodes a full URL, preserving characters like /, ?, & and #. encodeURIComponent encodes a single URL component (like a query value), converting those characters too. This tool uses encodeURIComponent by default.