URL Encoder & Decoder with Built-in URL Parser
Paste a URL to decode or encode it in real time. Built-in URL parser breaks down every component into editable fields. Dual mode: encodeURI & encodeURIComponent. Private — no data sent to any server.
What is URL Encoding (Percent Encoding)?
URL encoding, formally known as percent encoding, is a mechanism defined in RFC 3986 for representing characters in a Uniform Resource Identifier (URI) that are not allowed or have special meaning. It converts each unsafe byte into a percent sign (%) followed by two hexadecimal digits — for example, a space becomes %20, an ampersand becomes %26, and the Chinese character 中 becomes %E4%B8%AD (its three UTF-8 bytes, each percent-encoded).
URLs can only contain a limited set of characters from the ASCII character set. Letters, digits, and a handful of symbols (- _ . ~) are considered 'unreserved' and can appear as-is. All other characters — including spaces, punctuation, and the entire range of Unicode — must be percent-encoded to be safely transmitted in a URL. Reserved characters like ?, &, =, and # serve as structural delimiters in the URL syntax, so they must also be encoded when used as literal data rather than delimiters.
Percent encoding is essential throughout the web: browsers encode form submissions, APIs require encoded query parameters, OAuth flows depend on correctly encoded redirect URIs, and internationalized domain names rely on encoding for non-ASCII characters. Getting encoding wrong leads to broken links, security vulnerabilities (like open redirect attacks), and data corruption.
This tool provides both encodeURI and encodeURIComponent modes, a built-in URL structure parser, real-time conversion, and double-encoding detection — all running privately in your browser.
URL encoding is often used alongside other web development tools. You might need to Base64-encode a URL for embedding in a JWT token or API payload, or format JSON data that contains URL strings to inspect their structure.
// Encode a query parameter value
const param = encodeURIComponent('hello world & goodbye');
console.log(param); // → 'hello%20world%20%26%20goodbye'
// Encode a full URL (preserves structure)
const url = encodeURI('https://example.com/path name?q=hello world');
console.log(url); // → 'https://example.com/path%20name?q=hello%20world'
// Decode a percent-encoded string
const decoded = decodeURIComponent('hello%20world%20%26%20goodbye');
console.log(decoded); // → 'hello world & goodbye'
// Build a URL with encoded parameters
const base = 'https://api.example.com/search';
const query = `?q=${encodeURIComponent('你好')}&lang=zh`;
console.log(base + query); // → 'https://api.example.com/search?q=%E4%BD%A0%E5%A5%BD&lang=zh' Key Features
Dual Encoding Modes
Switch between encodeURI (preserves URL structure) and encodeURIComponent (encodes everything for parameter values) to match your exact use case.
Built-in URL Parser
Automatically breaks down any URL into protocol, host, port, path, query parameters, and fragment — each field is editable and can be rebuilt into a new URL.
Real-Time Conversion
Encode and decode instantly as you type — no buttons to click, results appear immediately in the other area with every keystroke.
100% Browser-Based
All processing happens locally in your browser using native JavaScript APIs. Your data never leaves your device — no server uploads, no tracking.
Full UTF-8 Support
Correctly handles Chinese, Japanese, Korean, Arabic, emoji, and any Unicode text through proper UTF-8 byte encoding and decoding.
Double Encoding Detection
Automatically detects and warns about double encoding issues like %2520 (a percent-encoded %20), helping you avoid one of the most common URL encoding mistakes.
Examples
Decode Garbled URL
https%3A%2F%2Fexample.com%2Fsearch%3Fq%3Dhello%20world%26lang%3Den
https://example.com/search?q=hello world&lang=en
A fully percent-encoded URL is decoded back to its human-readable form, revealing the original query parameters and structure
Chinese Characters
https://example.com/search?q=你好世界
https://example.com/search?q=%E4%BD%A0%E5%A5%BD%E4%B8%96%E7%95%8C
Chinese characters are converted to their UTF-8 byte sequences and percent-encoded
Query Parameters
https://example.com/api?name=John Doe&role=admin&lang=en&sort=date desc
https://example.com/api?name=John%20Doe&role=admin&lang=en&sort=date%20desc
Spaces and special characters in query parameter values are percent-encoded while preserving URL structure
Full URL
https://user:pass@example.com:8080/path/to/page?key=value&arr[]=1#section-2
https://user:pass@example.com:8080/path/to/page?key=value&arr%5B%5D=1#section-2
A complete URL with credentials, port, path, query parameters with brackets, and a fragment identifier
OAuth Redirect URI
https://auth.example.com/authorize?redirect_uri=https://myapp.com/callback?code=abc&state=xyz
https://auth.example.com/authorize?redirect_uri=https%3A%2F%2Fmyapp.com%2Fcallback%3Fcode%3Dabc%26state%3Dxyz
The redirect_uri value itself contains a full URL that must be encoded so that its special characters are not interpreted as part of the outer URL
How to Use
- 1
Enter a URL or Encoded String
Paste a URL in the decoded area to encode it, or paste a percent-encoded string in the encoded area to decode it. Select encodeURI or encodeURIComponent mode depending on your use case.
- 2
See Results and Parsed Structure
The other area updates instantly as you type. The URL parser breaks down the URL into protocol, host, port, path, query parameters, and fragment — all editable.
- 3
Copy or Rebuild
Click Copy to copy the encoded or decoded result. Edit individual URL components and click Rebuild to construct a new URL from the modified parts.
Common Errors
Double Encoding (%2520 instead of %20)
Double encoding occurs when an already-encoded URL is encoded again. The % in %20 gets encoded to %25, turning %20 into %2520. This breaks the URL because the server sees a literal %20 string instead of a space.
https://example.com/path%2520with%2520spaces
https://example.com/path%20with%20spaces
Space Encoded as + in Path Segments
The + character represents a space only in application/x-www-form-urlencoded format (query strings from HTML forms). In URL path segments, + is interpreted as a literal plus sign, not a space. Always use %20 for spaces in path segments.
https://example.com/my+file+name.pdf
https://example.com/my%20file%20name.pdf
Using encodeURI on Query Parameter Values
encodeURI() does not encode &, =, or other reserved characters, so using it on a parameter value that contains these characters corrupts the query string structure.
encodeURI('key=value&more') → 'key=value&more' (& not encoded!) encodeURIComponent('key=value&more') → 'key%3Dvalue%26more' Assuming Non-UTF-8 Encoding
Some legacy systems use encodings like Latin-1 or Shift-JIS for URL parameters. Modern standards require UTF-8. Decoding a Shift-JIS encoded parameter with a UTF-8 decoder produces corrupted text.
Decoding %82%B1%82%F1 as UTF-8 (this is Shift-JIS for こん)
Using UTF-8: %E3%81%93%E3%82%93 correctly decodes to こん
Encoding Relative Paths Without Context
Encoding a relative path like ../images/photo.jpg with encodeURIComponent turns the slashes and dots into percent-encoded sequences, breaking the path structure. Use encodeURI() or encode only the individual path segments.
encodeURIComponent('../images/photo.jpg') → '..%2Fimages%2Fphoto.jpg' Encode each segment: '../images/' + encodeURIComponent('my photo.jpg') Common Use Cases
- Debugging Garbled URLs
- Decode percent-encoded URLs from server logs, error messages, or browser dev tools to read the original human-readable text.
- API Development
- Encode query parameter values for REST API calls, ensuring special characters like &, =, and spaces don't break the request URL.
- OAuth Flow Setup
- Properly encode redirect_uri and other URL parameters in OAuth authorization URLs to prevent authentication failures.
- Internationalized URLs
- Encode and decode URLs containing Chinese, Japanese, Korean, Arabic, or other non-ASCII characters for internationalized web applications.
- Marketing Link Analysis
- Decode tracking URLs from email campaigns and advertising platforms to understand the embedded UTM parameters and redirect chains.
- URL Structure Inspection
- Parse complex URLs into their component parts — protocol, host, port, path, query parameters, and fragment — for analysis and modification.
Technical Details
- RFC 3986 Reserved & Unreserved Characters
- RFC 3986 defines unreserved characters (A-Z, a-z, 0-9, -, ., _, ~) that never need encoding, and reserved characters (:, /, ?, #, [, ], @, !, $, &, ', (, ), *, +, ,, ;, =) that serve as URI delimiters and must be percent-encoded when used as data.
- UTF-8 Byte Encoding Flow
- Non-ASCII characters are first converted to their Unicode code point, then encoded as UTF-8 bytes (1-4 bytes depending on the code point range), and finally each byte is percent-encoded as %XX. For example: é (U+00E9) → UTF-8 bytes C3 A9 → %C3%A9. The emoji 🎉 (U+1F389) → UTF-8 bytes F0 9F 8E 89 → %F0%9F%8E%89.
- URL vs URI Terminology
- A URI (Uniform Resource Identifier) is the general term for any identifier string. A URL (Uniform Resource Locator) is a URI that also specifies the access mechanism (like https://). The encoding rules in RFC 3986 apply to all URIs. JavaScript's API uses the URI terminology (encodeURI, decodeURI), while everyday usage favors URL.
Best Practices
- Use the Right Mode for the Job
- Use encodeURIComponent() for individual query parameter keys and values. Use encodeURI() only when you have a complete URL and want to encode unsafe characters without breaking its structure. Never use encodeURI() on parameter values that may contain &, =, or other reserved characters.
- Avoid Double Encoding
- Before encoding a string, check whether it is already encoded. Look for existing % sequences. Encoding an already-encoded string turns %20 into %2520, %3D into %253D, and so on. If you're unsure, decode first, then encode once.
- Decode on the Server Side
- Most web frameworks automatically decode URL parameters before your application code sees them. Avoid manually decoding parameters that your framework has already decoded — this can cause issues if the original value contained literal percent sequences.
- Encode Values for OAuth and API Signing
- OAuth 1.0 signature base strings and many API signing algorithms require strict RFC 3986 percent encoding. Use encodeURIComponent() and then replace any remaining characters that it doesn't encode (like !, ', (, ), *) with their percent-encoded equivalents if the spec requires it.
Frequently Asked Questions
What is URL encoding and why is it necessary?
What is the difference between encodeURI and encodeURIComponent?
Is URL encoding the same as HTML encoding?
Why does my URL break when I use it in a curl command?
Why do Chinese characters become strings like %E4%B8%AD in URLs?
Should I encode the OAuth redirect_uri parameter?
What is the difference between Node.js querystring and URLSearchParams?
How do I encode a URL in Python, JavaScript, and Java?
Which characters are not encoded by URL encoding?
What is the difference between + and %20 for encoding spaces?
How does URL encoding handle emoji?
Can URL encoding be used for encryption or security?
What is the maximum length of a URL?
What is the difference between a URL and a URI?
Related Tools
View all tools →Base64 Decoder & Encoder
Encoding & Formatting
Decode and encode Base64 online for free. Real-time conversion with full UTF-8 and emoji support. 100% private — runs in your browser. No signup needed.
JSON Formatter & Validator
Encoding & Formatting
Format, validate and beautify JSON instantly in your browser. Free online tool with syntax validation, error detection, minify and one-click copy. 100% private.
Number Base Converter — Binary, Hex, Decimal & Octal
Conversion Tools
Convert numbers between binary, hexadecimal, decimal, octal, and any custom base (2-36) instantly. Free, private, no sign-up — all processing happens in your browser.
Compress Images Online — JPEG, PNG & WebP
Conversion Tools
Reduce image size up to 80% — compress JPEG, PNG & WebP in your browser, no upload needed. Batch 20 images, adjust quality, compare before & after. Free & private.
Length Unit Converter — Metric, Imperial & More
Conversion Tools
1 inch = 2.54 cm, 1 foot = 0.3048 m, 1 mile = 1.609 km. Convert between 16 length units instantly — metric, imperial, nautical & astronomical. Free, private, runs in your browser.
MD5 Hash Generator & File Checksum Tool
Security Tools
Generate MD5, SHA-256, SHA-1 & SHA-512 hashes online for free. Hash text or files in your browser, verify checksums and copy results. No signup needed.