URL Encode / Decode
URL Encode / Decode
About URL Encode / Decode
URL encode online and URL decode online with our free percent-encoding tool. Convert special characters to and from percent-encoded format for query strings, API parameters, and path segments. Use this tool for safe query strings, API parameter encoding, and handling special characters in URLs.
Example
Input
hello world&foo=bar
Output
hello%20world%26foo%3Dbar
Why Use URL Encode / Decode?
- Safe query strings — Encode parameter values so spaces, ampersands, and equals signs do not break URL structure.
- API parameter encoding — Properly escape values when building URLs for REST APIs and web requests.
- Handling special characters — Convert reserved and unsafe characters to percent-encoded format for reliable transmission.
URL Encode / Decode FAQs
What is URL encoding?
URL encoding (percent-encoding) replaces unsafe characters with a percent sign followed by two hex digits. For example, a space becomes %20 and an ampersand becomes %26.
Why do I need to URL encode?
URLs can only contain a limited set of ASCII characters. Special characters like spaces, ampersands, and equals signs must be encoded to avoid breaking the URL structure.
What is the difference between encodeURI and encodeURIComponent?
encodeURI encodes a full URI but preserves characters like : / ? # that have meaning in URLs. encodeURIComponent encodes everything, making it suitable for individual query parameter values.
What characters need URL encoding?
Spaces, &, =, ?, #, and other reserved characters need URL encoding. Spaces become %20, ampersands %26, equals signs %3D, and so on. Unreserved characters (letters, digits, - _ . ~) typically do not need encoding.
Is URL encoding the same as HTML encoding?
No. URL encoding converts characters to percent-encoded format for URLs, while HTML encoding converts characters to HTML entities for safe display in browsers.