Encoding Converter

Character encoding determines how text is stored as bytes. UTF-8 (variable 1-4 bytes) is the web standard supporting all Unicode characters. UTF-16 (2 or 4 bytes) is JavaScript's native encoding. ASCII (7-bit, 0-127) covers English letters and basic symbols. Hexadecimal represents bytes as hex pairs (A=41, Hello=48 65 6C 6C 6F). Base64 encodes binary data as ASCII text using 64 characters. Common conversions: text to hex for debugging, Base64 for embedding data, ASCII extraction from UTF-8.

Convert text between character encodings: UTF-8, UTF-16, ASCII, Hexadecimal, and Base64. Decode hex strings, convert to Base64, or extract ASCII from UTF-8. Shows byte size for each encoding. Perfect for debugging encoding issues, preparing data for APIs, or converting between text formats. All processing happens in your browser.

Encoding Selection

Input Text

0 bytes

Encoding Reference

UTF-8:

Variable-width encoding (1-4 bytes per character). Supports all Unicode characters. Most common web encoding.

UTF-16:

Variable-width encoding (2 or 4 bytes). JavaScript's native string encoding. Used in Windows and Java.

ASCII:

7-bit encoding (0-127). Covers English letters, digits, and basic symbols. Non-ASCII characters converted to '?'.

Hexadecimal:

Represents bytes as hex pairs (00-FF). Example: "A" = 41, "Hello" = 48 65 6C 6C 6F.

Base64:

Encodes binary data as ASCII text using 64 characters (A-Z, a-z, 0-9, +, /). Used for embedding data in text formats.

How to Use

  1. Enter your value in the input field
  2. Click the Calculate/Convert button
  3. Copy the result to your clipboard

Frequently Asked Questions

What is character encoding and why does it matter?
Character encoding defines how text characters are stored as bytes. UTF-8 uses 1-4 bytes per character and supports all languages and emoji. ASCII uses 1 byte but only covers 128 characters (English letters, digits, symbols). Incorrect encoding causes mojibake—garbled text like "café" instead of "café". Always specify encoding when saving files or sending data to APIs to avoid corruption.
What is the difference between UTF-8 and UTF-16?
UTF-8 uses 1 byte for ASCII characters, 2-3 bytes for most languages, and 4 bytes for emoji. UTF-16 uses 2 bytes for most characters and 4 bytes for emoji. UTF-8 is more efficient for English text and dominates the web (98% of websites). UTF-16 is used internally by JavaScript, Java, and Windows. When in doubt, use UTF-8 for storage and transmission.
When should I use hexadecimal encoding?
Hexadecimal (hex) is used for debugging, viewing raw bytes, color codes (#FF5733), memory addresses, and low-level programming. Each byte is represented as two hex digits (00-FF). For example, "Hello" in hex is "48 65 6C 6C 6F". Hex is not for storing text—it is a visualization tool. Use UTF-8 for text storage; use hex when inspecting bytes.
What is Base64 encoding used for?
Base64 converts binary data into ASCII text using 64 characters (A-Z, a-z, 0-9, +, /). It is used to embed images in HTML/CSS (data URLs), send attachments in email (MIME), encode API tokens, and store binary data in JSON/XML. Base64 increases size by ~33% but allows binary data to pass through text-only systems. Not for encryption—Base64 is easily reversible.
How do I fix "invalid UTF-8" errors?
Invalid UTF-8 errors occur when bytes do not form valid UTF-8 sequences. Common causes: opening a file with wrong encoding, mixing encodings, or data corruption. Solutions: use encoding detection tools, specify correct source encoding when reading files, or convert from actual encoding (often Windows-1252 or ISO-8859-1) to UTF-8. Our converter can help identify encoding by trying different options.
What happens when I convert UTF-8 to ASCII?
Converting UTF-8 to ASCII removes or replaces non-ASCII characters (anything outside 0-127 range). Accented letters (é, ñ, ü) and symbols (€, ©, ™) become "?" or are removed. Use this conversion only when you need strict ASCII compatibility (some legacy systems). For modern systems, stick with UTF-8 which supports all characters worldwide.

Related Tools