URL Encoder/Decoder
Encode and decode URL strings for safe transmission
URL Encode
Encode and decode URLs with percent-encoding for safe web transmission. Handle special characters, Unicode text, and query parameters for web applications, API development, and HTTP request construction — fully browser-based with instant results.
URL Encoding and Percent-Encoding Explained for Web Developers
URL encoding — formally called percent-encoding — is the process of converting characters that have special meaning in URLs (or that are not valid in URL syntax) into a representation that can be safely transmitted as part of an HTTP request. The encoding replaces unsafe characters with a percent sign followed by the character's hexadecimal ASCII code: a space becomes `%20`, an ampersand becomes `%26`, and a forward slash becomes `%2F`.
The need for URL encoding arises from the fact that URLs can only contain a limited set of characters from the ASCII character set. Characters outside this set — Unicode letters from non-Latin alphabets, accented characters, symbols — must be first UTF-8 encoded and then percent-encoded. This is why a Chinese character in a URL becomes a sequence like `%E4%B8%AD%E6%96%87`.
Web developers encounter URL encoding in multiple contexts: constructing query string parameters programmatically (where values containing `&`, `=`, `?`, or `#` must be encoded to avoid being parsed as structural URL characters), building custom HTTP headers, creating deep links in mobile apps, and working with OAuth redirect URIs. Understanding the difference between `encodeURI()` and `encodeURIComponent()` — and when to use each — is a fundamental skill that prevents subtle bugs in URL construction.
encodeURI vs encodeURIComponent — Knowing When to Use Each
JavaScript provides two URL encoding functions with critically different behaviors. `encodeURI()` is designed to encode a complete URL — it leaves structural URL characters (`:`, `/`, `?`, `#`, `&`, `=`, `@`) untouched because they have meaning in the URL's structure. Use `encodeURI()` when you have a full URL and want to ensure it's safely encoded without breaking the URL's path or query string structure.
`encodeURIComponent()` is designed to encode a single URL component — a parameter name or value, a path segment, or a fragment identifier. It encodes everything except letters, digits, and the characters `- _ . ! ~ * ' ( )`, making the output safe to embed anywhere in a URL without accidentally being interpreted as structural syntax. The rule of thumb is simple: when building a query parameter value, always use `encodeURIComponent()`. Only use `encodeURI()` on a complete URL. And be aware that `+` in a query string is sometimes interpreted as a space (form encoding / application/x-www-form-urlencoded) and sometimes as a literal plus sign — `%20` is always unambiguous.
Building API Query String Parameters
Encode parameter values that contain special characters like `&`, `+`, `=`, or Unicode text before appending them to a URL. This is critical for search queries, filter values, and any user-provided input.
Debugging Encoded URLs in Browser DevTools
Decode percent-encoded URLs from network requests, redirect chains, or application logs to read the original parameter values and diagnose routing and redirect issues.
Creating Safe OAuth and Redirect URLs
OAuth 2.0 requires the `redirect_uri` parameter to be URL-encoded. Incorrectly encoded redirect URIs are one of the most common reasons OAuth authorization flows fail or return errors.
Handling Internationalized Domain Names and Unicode Paths
Encode URLs containing non-ASCII characters — Chinese, Arabic, Japanese, accented European characters — into their correct percent-encoded form for inclusion in HTTP requests and configuration files.
- 1
Paste Your URL or Text to Encode/Decode
Enter the raw text you want encoded (e.g., a query parameter value), or paste an already-encoded URL string you want decoded. The input area accepts both plain strings and full URLs.
- 2
Select the Encoding Mode
Choose 'Encode (Full URL)' to encode a complete URL while preserving its structural characters, 'Encode (Component)' to encode a single parameter value or path segment, or 'Decode' to convert percent-encoded text back to human-readable form.
- 3
Copy the Result for Your Application
The encoded or decoded output updates instantly. Click 'Copy' to transfer the result to your clipboard for use in your code, API request builder, terminal command, or configuration file.
Full URL Encoding and Component Encoding
Supports both `encodeURI` mode (preserves URL structure characters) and `encodeURIComponent` mode (encodes everything except unreserved characters), matching the encoding behavior of JavaScript and virtually every other programming language.
Unicode and International Character Support
Correctly handles Unicode characters by first applying UTF-8 encoding and then percent-encoding each byte, producing the internationally recognized representation used by all modern browsers and web standards.
Bidirectional — Encode and Decode Instantly
In decode mode, the tool reverses percent-encoding to return the original string — useful for reading encoded URLs in log files, browser address bars, network analyzer output, or OAuth parameter traces.
Instant Real-Time Results
The output updates with each keystroke, making it easy to test encoding behavior interactively, verify that specific characters are handled correctly, and iterate on URL construction logic quickly.
Found this tool useful?
Share your experience and help others discover it.