How do I URL-encode or decode a string online?
Paste your text and click Encode to percent-encode special characters for safe use in URLs, or paste an encoded string and click Decode to restore the original. The tool handles all Unicode characters and runs entirely in your browser.
hello world & goodbye!
hello%20world%20%26%20goodbye%21
URL Encoder & Decoder
Encode and decode URL components or full URIs. Fast, private, and free.
Quick Reference
Component mode uses encodeURIComponent / decodeURIComponent — encodes everything except A-Z a-z 0-9 - _ . ~ ! * ' ( ). Best for query parameter values and path segments.
Full URI mode uses encodeURI / decodeURI — preserves URL structure characters like : / ? # [ ] @ ! $ & ' ( ) * + , ; =. Best for encoding an entire URL while keeping its structure intact.
Tips & Best Practices
encodeURI vs encodeURIComponent: use the right one
encodeURI() encodes a full URL but preserves :, /, ?, #, and &. encodeURIComponent() encodes everything including those characters. Use encodeURIComponent() for individual query parameter values. Use encodeURI() only for complete URLs. Mixing them up creates double-encoded or broken URLs.
Spaces can be + or %20 depending on context
In URL query strings (after ?), spaces can be encoded as + (application/x-www-form-urlencoded, used in HTML forms) or %20 (RFC 3986). In URL paths (before ?), only %20 is valid. JavaScript's encodeURIComponent uses %20. PHP's urlencode uses +. Be consistent within your application.
Double encoding causes security bypasses
If your server decodes URL parameters twice, an attacker can bypass path traversal filters: %252e%252e%252f decodes to %2e%2e%2f then to ../. Always decode exactly once and validate after decoding. Web Application Firewalls often miss double-encoded payloads.
Non-ASCII characters require percent-encoding
The URL path /users/josé must be encoded as /users/jos%C3%A9 for HTTP transmission. Modern browsers display the decoded version in the address bar, but the actual request uses percent-encoding. APIs should accept and return percent-encoded URLs to avoid encoding ambiguity.
Frequently Asked Questions
What is URL encoding and why is it needed?
What is the difference between encodeURI and encodeURIComponent in JavaScript?
How do I decode a percent-encoded URL?
Related Convert Tools
JSON ↔ XML Converter
Convert JSON to XML and XML to JSON instantly — handles nested objects, arrays, attributes, CDATA sections, and XML declarations
CSS Unit Converter
Convert between px, rem, em, pt, vw, vh, and % — single values or batch-convert entire CSS files with configurable base font size
Base64 Codec
Encode and decode Base64 strings with Unicode support
Color Converter
Convert colors between HEX, RGB, and HSL formats