URL Encoder / Decoder
Encode and decode URL strings online. Supports full URL and component encoding.
Why URLs Need Encoding
URLs can only contain a limited set of ASCII characters. Spaces, non-ASCII characters, and
reserved symbols like &, =, and # must be
percent-encoded to travel safely through HTTP. A space becomes %20, an ampersand
becomes %26.
Component vs Full URL Encoding
encodeURIComponent() encodes everything except unreserved characters
(A-Z a-z 0-9 - _ . ~). Use it for query parameter values or path segments.
encodeURI() leaves structural characters (: / ? # [ ] @) intact.
Use it when encoding a complete URL where the structure should remain valid.
Common Encoding Mistakes
Double-encoding happens when you encode an already-encoded string — %20 becomes
%2520. This causes broken links and API errors. If your decoded output still
contains percent sequences, you likely need to decode again. This tool handles single-pass
encoding and decoding. For encoding binary data as text, see the
Base64 Encoder / Decoder.
Percent Encoding in Practice
API calls frequently pass user input through query strings. A search query like
"cats & dogs" must become cats%20%26%20dogs in the URL. Frontend frameworks
handle this automatically for most requests, but manual URL construction (string
concatenation in API clients, redirect URLs, OAuth callback parameters) requires explicit
encoding. The URL object in JavaScript (new URL()) handles encoding for query
parameters when you use the searchParams API. If you're building JSON payloads for
those API calls, the JSON Formatter can help you validate the structure.
Unicode and International Characters
Non-ASCII characters (accented letters, CJK characters, emoji) require multi-byte percent
encoding. The string "café" encodes to caf%C3%A9 because the UTF-8
representation of "é" is two bytes (0xC3, 0xA9). Internationalized domain names (IDNs)
use a separate Punycode encoding system, not percent encoding.
Frequently Asked Questions
- What is the difference between %20 and + for spaces?
%20is the standard percent-encoding for a space character. The+sign represents spaces only inapplication/x-www-form-urlencodedformat (HTML form submissions). In path segments and most query parameters, use%20. This tool usesencodeURIComponent(), which produces%20.- Is URL encoding reversible?
- Yes, URL encoding is fully reversible. Decoding replaces each percent-encoded sequence with the original character. The toggle in this tool lets you switch between encoding and decoding the same input.
- Why does my URL break after encoding?
- You likely used component encoding on a full URL, which encodes the
://,/, and?characters. Switch to Full URL mode (the checkbox in this tool) to preserve the URL structure while encoding only the unsafe characters.