Encoding Utilities
Encode and decode Base64, URL, Hex, Binary, ROT13, and more.
Multiple encoding formats
This tool supports common encoding formats used in web development, cryptography, and data transmission. All conversions happen locally in your browser.
Introduction
Every piece of data in a computer is just bytes — but humans need to read it, systems need to transport it, and developers need to debug it. Encoding utilities bridge this gap by converting between representations: hex for low-level debugging, binary for bitwise analysis, ASCII/Unicode for character inspection, and Base64 for safe transport. This multi-format encoder/decoder is the developer's microscope — it lets you examine data at every level of abstraction, from individual bits to full Unicode code points. When something is broken, the answer is almost always visible if you look at the data in the right format.
What This Tool Does
Why It Matters
Encoding mismatches cause some of the most baffling bugs in software development. A database stores UTF-8 but the API returns Latin-1, garbling accented characters. A binary protocol sends bytes in big-endian order but the client reads little-endian, interpreting data as nonsensical values. A hex string is one character short, causing a checksum failure that blocks an entire deployment. These bugs surface hours or days after the encoding error was introduced, making them expensive to diagnose. A multi-format encoding utility lets you inspect data at the byte level, compare representations side by side, and identify exactly where the encoding chain breaks.
How It Works
Step-by-Step Examples
Enter the text: Hello
Select 'Hex' encoding to see each character's byte value
Select 'Binary' to see the 8-bit binary representation of each byte
Compare all three representations to understand how 'Hello' is stored in memory
Hex: 48 65 6c 6c 6f | Binary: 01001000 01100101 01101100 01101100 01101111 | Decimal: 72 101 108 108 111Paste the hex string: 50 72 69 76 61 63 79 20 4d 61 74 74 65 72 73
Select 'Hex to Text' conversion mode
Click Decode to convert hex bytes back to readable text
Observe the decoded output: Privacy Matters
Privacy Matters — each pair of hex digits maps to an ASCII characterCode Examples
// String to hex
function textToHex(text) {
return Array.from(new TextEncoder().encode(text))
.map(b => b.toString(16).padStart(2, '0'))
.join(' ');
}
// Hex to string
function hexToText(hex) {
const bytes = hex.replace(/\s/g, '').match(/.{2}/g)
.map(b => parseInt(b, 16));
return new TextDecoder().decode(new Uint8Array(bytes));
}
// String to binary (8-bit per char)
function textToBinary(text) {
return Array.from(new TextEncoder().encode(text))
.map(b => b.toString(2).padStart(8, '0'))
.join(' ');
}
// Binary to string
function binaryToText(binary) {
const bytes = binary.split(' ')
.map(b => parseInt(b, 2));
return new TextDecoder().decode(new Uint8Array(bytes));
}
// String to decimal (Unicode code points)
function textToDecimal(text) {
return Array.from(text)
.map(c => c.codePointAt(0).toString())
.join(' ');
}
// Usage
const text = 'Hello';
console.log(textToHex(text)); // 48 65 6c 6c 6f
console.log(textToBinary(text)); // 01001000 01100101 01101100 01101100 01101111
console.log(textToDecimal(text)); // 72 101 108 108 111
console.log(hexToText('48 65 6c 6c 6f')); // Hellofunction detectEncoding(bytes) {
// Check for BOM (Byte Order Mark)
if (bytes[0] === 0xEF && bytes[1] === 0xBB && bytes[2] === 0xBF) {
return { encoding: 'UTF-8', bom: true, confidence: 'high' };
}
if (bytes[0] === 0xFF && bytes[1] === 0xFE) {
return { encoding: 'UTF-16 LE', bom: true, confidence: 'high' };
}
if (bytes[0] === 0xFE && bytes[1] === 0xFF) {
return { encoding: 'UTF-16 BE', bom: true, confidence: 'high' };
}
// Check for valid UTF-8 sequences
let isValidUTF8 = true;
let i = 0;
while (i < bytes.length) {
if (bytes[i] <= 0x7F) { i++; continue; }
if ((bytes[i] & 0xE0) === 0xC0) { i += 2; continue; }
if ((bytes[i] & 0xF0) === 0xE0) { i += 3; continue; }
if ((bytes[i] & 0xF8) === 0xF0) { i += 4; continue; }
isValidUTF8 = false;
break;
}
if (isValidUTF8) {
return { encoding: 'UTF-8', bom: false, confidence: 'medium' };
}
// Check for high bytes in Latin-1 range
const hasHighBytes = bytes.some(b => b > 127);
if (hasHighBytes) {
return { encoding: 'Latin-1 (ISO-8859-1)', bom: false, confidence: 'low' };
}
return { encoding: 'ASCII', bom: false, confidence: 'high' };
}
// Usage
const sample = new TextEncoder().encode('Hello, 世界');
console.log(detectEncoding(sample));
// { encoding: 'UTF-8', bom: false, confidence: 'medium' }Character Encoding Comparison
| Encoding | Bytes per Char | Character Range | Byte Order | Use Case |
|---|---|---|---|---|
| ASCII | 1 | 0-127 (7-bit) | N/A | English-only systems, legacy protocols |
| Latin-1 (ISO-8859-1) | 1 | 0-255 (8-bit) | N/A | Western European text, HTTP headers |
| UTF-8 | 1-4 | Full Unicode (U+0000 to U+10FFFF) | N/A | Web, databases, APIs (dominant standard) |
| UTF-16 | 2 or 4 | Full Unicode | BOM-dependent | Windows internals, JavaScript engines |
| UTF-32 | 4 | Full Unicode | BOM-dependent | Internal processing, fixed-width requirements |
Number System Conversion Table
| Decimal | Hex | Binary | Octal | ASCII Char |
|---|---|---|---|---|
| 65 | 41 | 01000001 | 101 | A |
| 97 | 61 | 01100001 | 141 | a |
| 48 | 30 | 00110000 | 60 | 0 |
| 32 | 20 | 00100000 | 40 | Space |
| 33 | 21 | 00100001 | 41 | ! |
| 128 | 80 | 10000000 | 200 | € (in Latin-1) |
Benefits
- Convert between hex, binary, decimal, and ASCII representations for complete byte-level data inspection.
- Supports UTF-8, UTF-16, UTF-32, ASCII, and Latin-1 encoding detection and conversion.
- Instant, client-side conversion — no server requests, no data leakage, works fully offline.
- Side-by-side comparison of multiple representations for debugging encoding mismatches.
Use Cases
Debugging character encoding issues in databases, APIs, and file systems where data appears garbled or corrupted.
Inspecting binary protocol payloads at the byte level to identify framing, endianness, and field boundary issues.
Verifying checksum calculations by comparing hex representations of computed versus expected values.
Analyzing network packet captures by converting raw hex dumps to readable text and structured data.
Common Mistakes to Avoid
Assuming all text is UTF-8 — legacy systems may use Latin-1, Windows-1252, or other encodings that produce different byte sequences.
Confusing hex with binary — 0x1F is 31 in decimal, not 1 followed by 1.
Ignoring byte order marks (BOM) — UTF-16 files without BOM can be read as big-endian or little-endian, producing garbage.
Converting between encodings without preserving the original — re-encoding Latin-1 as UTF-8 doubles the byte size for characters above 127.
Security Implications
Encoding utilities reveal the raw byte content of data, which may contain hidden payloads, steganographic data, or non-printable control characters. Binary data in hex format can reveal embedded null bytes (0x00), escape sequences, or Unicode directional characters (U+202E Right-to-Left Override) used in text direction attacks. When displaying decoded content, be aware that Unicode characters can spoof visual appearance — Cyrillic 'а' (U+0430) looks identical to Latin 'a' (U+0061) but encodes differently. Always validate encoding of user-supplied data before processing.
Security Information
Frequently Asked Questions
References & Further Reading
What is Data Encoding?
Data encoding is the process of converting data from one format to another using a specific set of rules or schemes. Encoding is essential in computing for representing information in a format that can be safely transmitted, stored, or processed. Unlike encryption, encoding is not meant to hide information, but to ensure it can be correctly interpreted across different systems.
Common encoding formats include Base64 for binary-to-text encoding, URL encoding for safely transmitting data in web addresses, and Hex encoding for representing binary data as hexadecimal strings. Each format serves a specific purpose and has particular use cases where it excels.
How Different Encoding Formats Work
Base64 converts binary data to ASCII text using 64 printable characters (A-Z, a-z, 0-9, +, /). It is used for embedding images in HTML/CSS, transmitting binary data over text-based protocols like email, and encoding API credentials. The output is approximately 33% larger than the input.
URL Encoding (Percent Encoding) replaces unsafe characters with a percent sign followed by two hexadecimal digits. Spaces become %20, special characters like @ become %40. This ensures URLs remain valid when containing data that would otherwise break the URL structure.
Hexadecimal Encoding represents each byte as two hexadecimal characters (0-9, a-f). It is used in cryptography for displaying hash values, in network protocols for representing MAC addresses, and in debugging for examining binary data.
ROT13 and Caesar Cipher are simple substitution ciphers that shift characters by a fixed amount. ROT13 shifts by 13 positions, while Caesar Cipher allows any shift value. These are used for hiding spoilers in text and basic obfuscation, not for security.
Real-World Encoding Applications
Web Development: Base64 encoding is used to embed small images directly in CSS (data URIs), reducing HTTP requests. URL encoding is essential for form submissions and API query parameters.
API Authentication: HTTP Basic Authentication uses Base64 to encode "username:password" pairs before sending them in the Authorization header. Many APIs also use hex encoding for tokens and signatures.
Data Transmission: Email attachments (MIME) use Base64 to encode binary files like images and documents into text-safe format for transmission over SMTP.
Cryptographic Analysis: Hex encoding is the standard way to display cryptographic hashes, digital signatures, and encrypted data. Security professionals frequently convert between binary and hex when analyzing system outputs.
Encoding Mistakes to Avoid
Confusing Encoding with Encryption: Base64 is NOT encryption. Anyone can decode Base64 with a simple tool. Never use Base64 to protect sensitive data like passwords or API keys. Use proper encryption (AES, RSA) for data confidentiality.
Double Encoding: Applying URL encoding twice to the same string produces incorrect results. For example, encoding "hello world" gives "hello%20world", but encoding again gives "hello%2520world" (with literal %25 instead of %). Always check if data has already been encoded.
Character Set Issues: Base64 encoding assumes UTF-8 input. Encoding binary data that is not valid UTF-8 can produce incorrect results. Always ensure your input is properly encoded before Base64 conversion.
Using ROT13 for Security: ROT13 is not encryption and provides zero security. It is a trivially reversible transformation used only for hiding spoilers or surprise content, never for protecting sensitive information.
Related Encoding and Hash Tools
Complement your encoding workflow with these tools:
- URL Encoder — Dedicated URL encoding and decoding tool with advanced options.
- SHA-256 Generator — Generate cryptographic hashes and view them in hex format.
- SHA Hash Tools — Multi-algorithm hash generation including SHA-1, SHA-256, SHA-384, and SHA-512.
- MD5 Generator — Generate MD5 hashes for file integrity verification.
- Hash Identifier — Identify unknown hash types by analyzing their format and length.