Encoding Convert

Examples

How to Use

🔄 Overview

Encode and decode Unicode and Base64. Unicode converts text to escape sequences or code points; Base64 encodes text for transport and storage.

📖 How It Works

Unicode assigns a unique code point to each character. Encoding maps text to those code points; decoding maps them back to readable text.

Base64 represents binary data with 64 printable characters — every 3 bytes become 4 characters — so binary data can travel in text-only systems.

✨ Features

  • Unicode encode: Escape sequences (\uXXXX), hex (U+XXXX), or decimal code points.
  • Unicode decode: Recognizes multiple Unicode formats and converts to text.
  • Base64: Encode and decode between text and Base64 strings.
  • Live conversion: Updates as you type.
  • Format options: Choose Unicode output format.
  • Local processing: Runs entirely in the browser.
  • Copy: One-click copy of results.

💡 Steps

Unicode encode / decode
  1. Enter text in the "Source" field.
  2. Pick a Unicode output format (escape / hex / decimal).
  3. Click "Encode →" or type to encode automatically.
  4. View the result in the Unicode field.
  5. Click "Copy result" to copy.
  6. To decode, paste encoded text in the Unicode field and click "← Decode".
Base64 encode / decode
  1. Enter text in the "Source" field.
  2. Click "Encode →" or type to encode automatically.
  3. View the result in the Base64 field.
  4. Click "Copy result" to copy.
  5. To decode, paste Base64 in the Base64 field and click "← Decode".

📋 Formats

  • Unicode escape: \uXXXX, e.g. \u4f60\u597d for 你好.
  • Unicode hex: U+XXXX, e.g. U+4F60 U+597D for 你好.
  • Unicode decimal: Decimal code points, e.g. 20320 22909 for 你好.
  • Base64: A–Z, a–z, 0–9, +, /; padding with = when needed.

🎯 Use Cases

  • Unicode escapes in JavaScript.
  • Encoding special characters in URLs or JSON.
  • Base64 in APIs and data transfer.
  • Base64 for images and files.
  • Debugging character encoding.
  • Cross-platform data encoding.
  • API payload encoding.

💻 Examples

Unicode in JavaScript:
// Unicode escape sequences
const text1 = '\u4f60\u597d'; // "你好"

// Get a character's code point
const codePoint = '你'.codePointAt(0); // 20320
const hex = codePoint.toString(16); // "4f60"

// Create a character from a code point
const char = String.fromCodePoint(0x4f60); // "你"
Base64 in JavaScript:
// BASE64 encode
const text = 'Hello, 世界!';
const encoded = btoa(unescape(encodeURIComponent(text)));
// "SGVsbG8sIOS4lueVjCE="

// BASE64 decode
const decoded = decodeURIComponent(escape(atob(encoded)));
// "Hello, 世界!"
Base64 in Python:
import base64

# BASE64 encode
text = 'Hello, 世界!'
encoded = base64.b64encode(text.encode('utf-8')).decode('ascii')
# "SGVsbG8sIOS4lueVjCE="

# BASE64 decode
decoded = base64.b64decode(encoded).decode('utf-8')
# "Hello, 世界!"

⚠️ Notes

  • Some Unicode characters need surrogate pairs.
  • Base64 increases size by about 33%.
  • In JavaScript, UTF-8-encode text before Base64 when using non-ASCII.
  • Base64 strings may end with = or == padding.
  • Decoding ignores non-Base64 characters (spaces, line breaks, etc.).
  • All processing is local.
  • Very large text may slow the browser; split long input if needed.

❓ FAQ

  • What is the difference between Unicode encode and decode?
    Encode turns text into code points; decode turns code points back into text.
  • Can Base64 be used in URLs?
    Yes, but URL-safe Base64 often replaces + with -, / with _, and drops padding.
  • Why does Base64 end with =?
    = is padding when the input length is not a multiple of 3 bytes.
  • Are escape letters upper or lower case?
    Lowercase is common (\u4f60); uppercase (\u4F60) also works. This tool uses lowercase.
  • Does it handle emoji?
    Yes — emoji encode to Unicode code points; some need surrogate pairs.