URL Encoder/Decoder
Encode & decode URLs, parse query strings, analyze URL structure. All client-side.
URL Encoding Modes Compared
| Character | encodeURIComponent | encodeURI | Full Encode |
|---|---|---|---|
| Space ( ) | %20 | %20 | %20 |
| / (slash) | %2F | / | %2F |
| ? (question) | %3F | ? | %3F |
| & (ampersand) | %26 | & | %26 |
| = (equals) | %3D | = | %3D |
| # (hash) | %23 | # | %23 |
| @ (at) | %40 | @ | %40 |
| : (colon) | %3A | : | %3A |
When to Use Which Encoding Mode
encodeURIComponent
Use for encoding query parameter keys and values. Encodes everything except A-Z a-z 0-9 - _ . ~ ! * ' ( ). The safest choice for user input in URLs.
encodeURI
Use for encoding a full URL while preserving its structure. Keeps : / ? # [ ] @ ! $ & ' ( ) * + , ; = intact. Best when encoding a complete URL string.
Full Encode
Encodes everything except alphanumeric characters. Maximum safety for untrusted input. Use when building URLs for strict security contexts or APIs that require aggressive encoding.
Frequently Asked Questions
What is the difference between %20 and + for spaces?
%20 is the standard percent-encoding for a space character defined by RFC 3986. The + sign for spaces is only valid in the application/x-www-form-urlencoded format (HTML form submissions). In query strings, both are commonly accepted, but %20 is always safe. encodeURIComponent produces %20, while URLSearchParams produces +.
What is the difference between encodeURI and encodeURIComponent?
encodeURI is designed to encode a complete URI, so it preserves characters that have special meaning in URLs (: / ? # @ etc.). encodeURIComponent encodes everything except unreserved characters, making it safe for encoding individual query parameter values. Use encodeURIComponent for parameter values, encodeURI for full URLs.
What is double-encoding and why is it a problem?
Double-encoding happens when already-encoded text is encoded again — for example, %20 becomes %2520 (the % is encoded to %25). This causes servers to decode only one level, leaving percent-encoded artifacts in the final value. Always check if your input is already encoded before encoding it.
Is this tool secure? Is my data sent to a server?
All encoding and decoding happens entirely in your browser using JavaScript's built-in encodeURIComponent, encodeURI, and decodeURIComponent functions. No data is sent to any server.
Why are some characters not encoded by encodeURI?
encodeURI is meant to produce a valid URI from a string. Characters like : / ? # have structural meaning in URLs (separating protocol, path, query, fragment). Encoding them would break the URL structure. If you need to include these characters literally in a value, use encodeURIComponent instead.
Related Tools
Format, validate, and beautify JSON with tree view and TypeScript type generation.
Test regular expressions with real-time matching, capture groups, and code snippets.
Generate UUID v4, v7, ULID, and Nano ID with bulk generation and format options.
Encode and decode text, images, and files to Base64 with real-time conversion.