CalKit

URL Encoder/Decoder

Encode and decode URL strings.

Overview

Encode special characters in URLs using percent-encoding (%XX), or decode encoded URLs back to the original text. Essential for handling query parameters, API calls, and link sharing.

Formula

Percent-encoding process: Convert characters to UTF-8 bytes, then replace each byte of reserved and non-ASCII characters with '%' followed by a 2-digit uppercase hex value. Example: '한' → UTF-8 [0xED, 0x95, 0x9C] → '%ED%95%9C'. Unreserved characters (A–Z, a–z, 0–9, -, _, ., ~) are not encoded. Decoding reverses the process: convert %XX to bytes, then UTF-8 decode.

How to Use

  1. 1Select encode or decode mode.
  2. 2Enter the URL or text.
  3. 3The conversion result is displayed automatically.
  4. 4Copy the result for use.

Tips

  • Spaces are encoded as '+' (application/x-www-form-urlencoded) or '%20' in URLs.
  • Only encode query parameter values, not the entire URL. URL structural characters like '://', '?', and '&' should be preserved.
  • Be careful of double encoding (encoding an already-encoded string).
  • In JavaScript use encodeURIComponent(); in Python use urllib.parse.quote().

FAQ

Q. Why is URL encoding necessary?

URLs can only use a limited set of ASCII characters. To include characters like non-Latin scripts, spaces, or special symbols in a URL, they must be converted via percent-encoding. Without encoding, URLs may break or be misinterpreted.

Q. What is the difference between encodeURI() and encodeURIComponent()?

encodeURI() encodes a full URL but preserves URL structural characters (:, /, ?, #, &, etc.). encodeURIComponent() encodes all special characters, making it suitable for encoding query parameter values.

Q. What is the difference between '+' and '%20'?

'+' represents a space in HTML form data (application/x-www-form-urlencoded), while '%20' is the space encoding per RFC 3986. Use '%20' in URL paths.

Related Calculators