URL Encode/Decode Online (Percent Encoding)
Percent-encode or decode text for URLs. Switch between encodeURI and encodeURIComponent, convert Unicode domain names to punycode (xn--), and explore an interactive RFC 3986 reserved-character table — all in your browser.
What is URL Encoder / Decoder?
URL encoding (percent-encoding) converts characters that are not allowed in URLs into a % followed by two hexadecimal digits. It's essential for safely transmitting data through query parameters, form submissions, and API calls.
Zero-Server Tool Data Guarantee
All encoding, decoding, punycode conversion, and table lookups happen locally in your browser. Your URLs, query values, and form data never leave your device — no server upload, no logging, no tracking.
How to Use
Pick a Mode
Encode makes a string URL-safe; Decode reverses percent-encoding. The Encoding selector only affects encode output.
Choose encodeURI or encodeURIComponent
encodeURIComponent (default) encodes a query value safely; encodeURI preserves the structure of a full URL.
Paste, Type, or Drop a File
Paste a URL, query value, or percent-encoded string, or drop a text file.
Enable IDN (punycode) for Domains
Turn on 'IDN (punycode)' to convert Unicode domain names to their xn-- ASCII form and back.
Copy
The output updates in real time; use the copy button to grab the result.
Common Use Cases
Query Parameter Encoding
Encode user-provided search terms, filters, or form data before appending them to a URL.
API Request Building
Properly encode values in REST API URLs to handle special characters, spaces, and Unicode.
Form Data Submission
Convert form field values to percent-encoded format for POST requests with application/x-www-form-urlencoded.
International Domain Names
Convert Unicode domains (éxample.com) to their ASCII punycode form for DNS and links.
Debugging Redirects
Decode percent-encoded URLs to understand what data is being passed between services.
Implementation Examples
// Encode a value for use in a query parameterconst search = encodeURIComponent('hello world & more');// "hello%20world%20%26%20more"// Decode it backconst decoded = decodeURIComponent('hello%20world%20%26%20more');// "hello world & more"// encodeURI preserves URL structure (leaves :, /, ?, &, =, #)const uri = encodeURI('https://x.com/a b?q=1');// "https://x.com/a%20b?q=1"// Build a full URL with encoded paramsconst url = `https://api.example.com/search?q=${encodeURIComponent('test & demo')}`;
encodeURI vs encodeURIComponent
| Function | Encodes | Use For |
|---|---|---|
| encodeURI | Only unsafe chars (preserves :, /, ?, &, =) | Encoding a full URL |
| encodeURIComponent | All special chars (preserves only A-Z, a-z, 0-9, - _ . ! ~ * ' ( )) | Encoding a query value or path segment |
Production Best Practices & Security
Frequently Asked Questions
URL encoding (also called percent-encoding) replaces characters that are not safe in URLs with a % followed by two hex digits. A space becomes %20, an ampersand becomes %26, and a hash becomes %23.
Without this encoding, browsers and servers would misinterpret your URLs. A space would truncate the address. A & in a query value would look like a parameter separator. International characters like ü or ñ would be garbled.
It is defined by RFC 3986, and JavaScript's encodeURIComponent() handles it automatically.