URL Encoder & Decoder
Encode or decode URLs and URL components instantly. Switch between component mode and full URL mode. All processing runs in your browser.
What Is URL Encoding?
URL encoding (also called percent-encoding) is a mechanism for converting characters that are not allowed in URLs into a format that can be transmitted safely. It replaces unsafe characters with a percent sign (%) followed by two hexadecimal digits representing the character's byte value. For example, a space becomes %20 and an ampersand becomes %26.
This free online tool encodes and decodes URLs in real time as you type. It supports two modes: Component mode (encodeURIComponent) for encoding individual URL parameters, and Full URL mode (encodeURI) for encoding complete URLs while preserving structural characters like :, /, ?, and #. All processing runs entirely in your browser — no data is ever sent to a server.
Key Features
- Real-time encoding and decoding — output updates instantly as you type
- Component mode (encodeURIComponent) — encodes all special characters including :, /, ?, #, &, and =
- Full URL mode (encodeURI) — encodes special characters while preserving URL structure characters
- Swap button to quickly reverse the operation and feed output back as input
- File upload support for encoding or decoding text files
- One-click download and copy to clipboard
- Fullscreen mode for working with long URLs
- Full UTF-8 support — correctly encodes multi-byte characters including emoji and international text
- 100% client-side processing — your URLs and data never leave your browser
- Clean, responsive interface that works on desktop and mobile
How to Use This Tool
- Select the mode: Encode (text to percent-encoded) or Decode (percent-encoded to text).
- Type or paste your input in the left panel. The result appears instantly in the right panel.
- Choose Component mode to encode everything (for query parameters) or Full URL mode to preserve URL structure.
- Use the swap button to reverse the operation — great for checking encode/decode round-trips.
- Click Copy to copy the result, or Download to save it as a file.
Why URL Encoding Matters
URLs can only contain a limited set of ASCII characters. Special characters like spaces, ampersands, question marks, and non-ASCII characters (accented letters, CJK characters, emoji) must be percent-encoded to be transmitted correctly in URLs. Without proper encoding, URLs break — browsers misinterpret the structure, servers reject the request, or data gets corrupted during transmission.
The distinction between Component and Full URL encoding is critical. When building query parameters (e.g., ?search=hello world&page=1), you must use Component encoding (encodeURIComponent) to encode each parameter value individually. If you used Full URL encoding, characters like & and = would be preserved, breaking the query string structure. Conversely, when encoding an entire URL, Full URL mode preserves the structural characters that define the URL's scheme, host, path, and query.
Common Use Cases
- Building API query strings — properly encode parameter values containing special characters or spaces
- Debugging malformed URLs — decode percent-encoded URLs to read the original text and identify issues
- Form data handling — encode user input for safe inclusion in URL query parameters
- Redirect URLs — encode callback URLs passed as parameters in OAuth and authentication flows
- Internationalization — encode URLs containing non-ASCII characters like accented letters or CJK text
- Web scraping — decode extracted URLs to get the original addresses
- Deep linking — construct properly encoded deep links for mobile apps and single-page applications
Understanding Percent-Encoding
In percent-encoding, each byte of a character is represented as %XX where XX is the two-digit hexadecimal value. ASCII characters like A-Z, a-z, 0-9, and a few special characters (-, _, ., ~) are considered unreserved and do not need encoding. All other characters must be encoded.
For UTF-8 multi-byte characters, each byte is encoded separately. For example, the Chinese character for 'middle' is encoded as %E4%B8%AD (three bytes). This is why URL encoding can significantly increase the length of strings containing non-ASCII text. The encodeURIComponent function in JavaScript handles this automatically, converting the string to UTF-8 bytes first, then percent-encoding each byte.
Tips for URL Encoding
- Always use encodeURIComponent for individual query parameter values — never encode the entire URL this way
- Use encodeURI only when you need to encode a complete URL while preserving its structure
- Double-encoding is a common bug — encoding an already-encoded string turns %20 into %2520
- When debugging, decode the URL first to see the actual values, then re-encode if needed
- Spaces can be encoded as either %20 or + in query strings — %20 is the standard but + is common in form submissions
- Remember that JavaScript decodeURI and decodeURIComponent throw errors on malformed input — this tool handles these errors gracefully
