How to use URL Encoder / Decoder
The URL Encoder / Decoder converts special characters in URLs to and from their percent-encoded equivalents. Spaces, non-ASCII letters, and reserved characters such as &, =, and # must be percent-encoded before being included in a URL query string or path segment. This tool is essential when constructing API calls, debugging HTTP requests and embedding dynamic values in links.
- Paste the text or URL you want to encode or decode into the input field.
- Choose Encode to convert special characters to %XX sequences.
- Choose Decode to convert %XX sequences back to readable characters.
- Select the encoding scope: encode full URL (preserves ://) or encode component (encodes everything including :, /, ?).
- Copy the result from the output panel.
Your data never leaves your device — 100% private processing.
Percent-encoding rules
Percent-encoding replaces each unsafe byte with a % sign followed by two uppercase hexadecimal digits representing that byte value. RFC 3986 defines unreserved characters (A–Z, a–z, 0–9, -, _, ., ~) which must never be encoded. Reserved characters (: / ? # [ ] @ ! $ & ' ( ) * + , ; =) have special meaning in URLs and must be encoded when used as literal data in a component. A space is encoded as %20 (or + in application/x-www-form-urlencoded form data).
encodeURI vs encodeURIComponent
JavaScript provides two built-in functions for URL encoding. encodeURI is intended for a complete URL and leaves reserved characters (/, ?, #, &, =, :) intact so the URL structure remains valid. encodeURIComponent encodes all characters except unreserved ones, making it safe for encoding individual query parameter names and values. Always use encodeURIComponent for user-supplied data in query strings to prevent injection of additional parameters.
| Character | encodeURI | encodeURIComponent |
|---|---|---|
| Space | %20 | %20 |
| / | preserved | %2F |
| ? | preserved | %3F |
| # | preserved | %23 |
| & | preserved | %26 |
| = | preserved | %3D |
| @ | preserved | %40 |
Worked examples
Encode a query value
Inputs: 'a b&c'
Result: a%20b%26c
Encode a non-ASCII character
Inputs: 'café'
Result: caf%C3%A9
Decode percent-encoding
Inputs: 'https%3A%2F%2Fexample.com%2Fp%3Fx%3D1'
Result: https://example.com/p?x=1
Glossary
- Percent-encoding
- Replacing unsafe URL characters with a % followed by two hex digits representing the byte value.
- Query string
- The part of a URL after ? containing key=value pairs separated by & characters.
- URI
- Uniform Resource Identifier — a string that identifies a resource by location, name, or both.
- Reserved characters
- Characters with special meaning in URI syntax (/, ?, #, &, =, etc.) that must be encoded when used as literal data.
- IDN
- Internationalized Domain Name — a domain name containing non-ASCII characters, encoded using Punycode.
Related reading
Frequently Asked Questions
Why use URL Encoder / Decoder?
- Percent-encode special characters so they are safe to use in URL query strings
- Decode percent-encoded URLs back to readable text for debugging HTTP requests
- Choose full-URL or component-level encoding to match encodeURI vs encodeURIComponent semantics
- Handle Unicode characters by encoding them to their UTF-8 percent-encoded byte sequences
Common use cases
- Encode a search query containing spaces and special characters for an API request
- Decode a percent-encoded redirect URL from a 302 response to diagnose a routing issue
- Build a webhook callback URL that includes a Base64-encoded parameter in the query string
- Encode a JSON blob as a URL-safe query-string value for a GET request
- Decode an OAuth redirect URI to verify state parameter encoding is correct
Get weekly tool tips & updates
New tools, power-user tips, and productivity hacks — delivered free every Friday.
No spam, ever. Unsubscribe with one click.
Related Developer Tools
HTML Encoder / Decoder
Encode and decode HTML entities online. Escape <, >, &, and quote characters for safe HTML display. Free, instant, and private — runs in your browser.
Base64 Encoder & Decoder
Encode text or files to Base64, or decode Base64 strings back to text in seconds. Free, private, and fully in-browser now.
JSON Formatter & Validator
Format, validate, and minify JSON instantly. Includes syntax highlighting, error detection, and a collapsible tree view — free, private, in-browser.
JSON Escape / Unescape
Escape or unescape JSON strings online. Turn text into a safe JSON string literal, or decode an escaped string back to plain text. Free and in-browser.
String Escape / Unescape
Escape or unescape strings for JavaScript, Java, C/C++, JSON, SQL, CSV and shell. Safely embed quotes and special characters, processed in your browser.
Regex Tester
Test and debug regular expressions online. See live matches, capture groups, and replace output. Free, private, instant.
Explore all Developer Tools.