liminfo

URL Encoder

Free web tool: URL Encoder

About URL Encoder

The URL Encoder/Decoder is a free online tool for encoding and decoding URLs using percent-encoding (RFC 3986). It is essential for web developers working with query parameters, form data, API requests, and internationalized URLs that contain special characters, spaces, or non-ASCII characters like Korean, Chinese, or Japanese text.

This tool offers two encoding modes: encodeURIComponent mode for encoding individual query parameter values (encodes all special characters including =, &, /, ?, and #), and encodeURI mode for encoding full URLs while preserving the URL structure characters. Understanding this distinction is critical for avoiding double-encoding bugs and broken URLs in production applications.

All encoding and decoding operations run entirely in your browser using the native JavaScript encodeURI/decodeURI and encodeURIComponent/decodeURIComponent functions. No data is transmitted to any server, making this tool safe for encoding URLs that contain API keys, tokens, or other sensitive query parameters.

Key Features

  • Two encoding modes: encodeURIComponent for query parameters and encodeURI for full URLs
  • URL decoding that reverses percent-encoded strings back to their original characters
  • Full Unicode support for encoding Korean, Chinese, Japanese, Arabic, and other non-ASCII characters
  • Proper handling of reserved characters (!, #, $, &, +, ,, /, :, ;, =, ?, @) based on selected mode
  • Large text input support with textarea for encoding multi-line data or bulk URL parameters
  • One-click copy button for quickly transferring encoded/decoded results to your clipboard
  • Instant error feedback for malformed percent-encoded sequences (e.g., invalid %XX patterns)
  • Clean monospace font display for easy visual inspection of encoded output

Frequently Asked Questions

What is URL encoding (percent-encoding)?

URL encoding, formally called percent-encoding, is the process of converting characters that are not allowed in URLs into a format that can be safely transmitted. Each unsafe character is replaced with a percent sign (%) followed by its two-digit hexadecimal ASCII value. For example, a space becomes %20, an ampersand becomes %26, and the Korean character "han" becomes %ED%95%9C. This is defined in RFC 3986.

What is the difference between encodeURI and encodeURIComponent?

encodeURI encodes a full URL but preserves characters that have special meaning in URLs: ://?#[]@!$&'()*+,;= and the hash sign. Use it when encoding a complete URL. encodeURIComponent encodes everything except letters, digits, and - _ . ~ and is designed for encoding individual query parameter values. Using encodeURI on a parameter value can leave characters like & and = unencoded, which breaks the query string structure.

Which characters need to be URL-encoded?

Characters that must be percent-encoded in URLs include: spaces (encoded as %20 or +), non-ASCII characters (like Korean/CJK characters, accented letters), and reserved characters when used outside their special purpose (such as ? # & = in parameter values). The unreserved characters that never need encoding are: A-Z, a-z, 0-9, hyphen (-), underscore (_), period (.), and tilde (~).

How are Korean and CJK characters encoded in URLs?

Korean, Chinese, and Japanese characters are first converted to their UTF-8 byte sequences, then each byte is percent-encoded. For example, the Korean character "ga" is encoded as %EA%B0%80 (three bytes: EA, B0, 80 in UTF-8). Modern browsers display the decoded characters in the address bar but transmit the encoded form to servers.

What is double encoding and how do I avoid it?

Double encoding occurs when an already-encoded string is encoded again, turning %20 into %2520 (the % itself gets encoded to %25). This commonly happens when a URL is encoded, then passed through another encoding function. To avoid it, always check whether your input is already encoded before encoding it. You can use this tool's decode function first to verify, or check for existing %XX patterns in your string.

Should I use %20 or + for spaces in URLs?

Both represent spaces, but in different contexts. %20 is the standard percent-encoding for spaces and should be used in URL paths and most contexts. The + sign for spaces is specific to the application/x-www-form-urlencoded format used in HTML form submissions and query strings. Modern best practice is to use %20 for URL paths and either %20 or + for query parameters. JavaScript's encodeURIComponent uses %20.

Why does my API return garbled text when I don't URL-encode parameters?

When special characters like &, =, or # appear unencoded in query parameters, the server interprets them as URL structure delimiters rather than literal characters. An unencoded & splits your parameter value into multiple parameters, = creates a new key-value pair, and # truncates everything after it. Non-ASCII characters without encoding may be misinterpreted depending on the server's character set assumptions. Always encode parameter values with encodeURIComponent.

Can I decode a full URL with mixed encoded and plain segments?

Yes. Select the encodeURI (full URL) mode, paste the URL into the input field, and click Decode. The decodeURI function will convert percent-encoded characters back to their original form while leaving URL structure characters intact. If the URL contains doubly-encoded sequences (like %2520), you may need to run the decode operation twice to fully restore the original characters.