Binary Decoder
Online binary to text converter and binary code translator — decode binary or encode text to binary, with a per-byte bit table.
Free online binary decoder and binary translator — paste any binary string (space-grouped or continuous 0s and 1s) to instantly decode binary to UTF-8 text, or switch to text to binary mode to encode any string. Toggle the bit table to see each byte broken down as binary, decimal, hex, and character. No signup, runs entirely in your browser.
Mode
Input format
Output format
Expands each byte into its binary, decimal, hex, and character representation.
Quick reference
- 01001000
- → 72 → 'H'
- 01100101
- → 101 → 'e'
- 00100000
- → 32 → ' ' (space)
- 11110000 10011111
10011000 10001010 - → 😊 (4-byte UTF-8)
| # | Binary | Dec | Hex | Char |
|---|---|---|---|---|
What is binary code?
Binary code is the base-2 number system that underpins all digital computing. Every file, image, message, and program your computer stores or processes is ultimately represented as a sequence of 0s and 1s. The reason computers use binary is physical: a transistor has exactly two stable states — on and off — which map naturally to 1 and 0.
The key units in binary are:
- Bit — the smallest unit; a single 0 or 1
- Nibble — 4 bits (half a byte); can represent values 0–15 or one hex digit
- Byte — 8 bits; can represent values 0–255 and encodes one ASCII character
- Kilobyte (KB) — 1,024 bytes; and so on up to MB, GB, TB
When people talk about "binary code" for text, they are referring to the encoding of each character's numeric code (from the ASCII or Unicode standard) as an 8-bit binary number. The letter 'A' has ASCII code 65, which is 01000001 in 8-bit binary.
How binary represents text — ASCII and UTF-8
Text is stored in binary using a character encoding — a lookup table that maps each character to a number. The two most important encodings are:
- ASCII — Defines 128 characters (English letters, digits, punctuation, and control codes), each mapped to a number 0–127. Since 127 fits in 7 bits, ASCII characters need at most one byte. 'H' = 72 =
01001000. - UTF-8 — The modern standard, backward-compatible with ASCII for the first 128 characters. Extends to cover all 1.1 million Unicode characters by using 2–4 bytes for non-ASCII characters. An emoji like 😊 is 4 bytes; an accented letter like é is 2 bytes.
Binary decoding of text works in three steps: (1) split the binary string into 8-bit groups, (2) convert each group from base-2 to a decimal number, (3) look up that decimal number in the UTF-8 table to get the character. "Hello" decodes as:
01001000 → 72 → H
01100101 → 101 → e
01101100 → 108 → l
01101100 → 108 → l
01101111 → 111 → o
How to decode binary to text: step by step
The algorithm is straightforward once you know the rule: 8 bits = 1 byte = 1 character (for ASCII). Here is a worked example converting 01001000 01101001 ("Hi"):
- Split into 8-bit groups:
01001000and01101001 - Convert base 2 → base 10:
01001000= 0×128 + 1×64 + 0×32 + 0×16 + 1×8 + 0×4 + 0×2 + 0×1 = 72;01101001= 64+32+8+1 = 105 - Look up in ASCII table: 72 = 'H', 105 = 'i'
- Result: "Hi"
For multi-byte UTF-8 characters (anything outside ASCII), the process is the same — collect the bytes in order and pass them through a UTF-8 decoder. Most languages have a built-in decoder; this tool uses the browser's native TextDecoder API.
If you get a length error ("binary length is not a multiple of 8"), a stray space, missing digit, or extra character has broken the byte boundary. Toggle Input format → Continuous if your binary has no spaces, or Space groups if it is already grouped into 8-character chunks.
How to decode binary to text in JavaScript, Python, and PHP
You rarely need to decode binary manually in code — but when you do, here are minimal implementations in three languages. All of them handle the full UTF-8 character set.
JavaScript (browser & Node.js)
// Decode: binary string → text
function binaryDecode(binaryStr) {
const bits = binaryStr.replace(/\s+/g, '');
if (bits.length % 8 !== 0) throw new Error('Length must be a multiple of 8');
const bytes = new Uint8Array(
bits.match(/.{8}/g).map(b => parseInt(b, 2))
);
return new TextDecoder('utf-8').decode(bytes);
}
// Encode: text → binary string (space-grouped)
function binaryEncode(text) {
return Array.from(new TextEncoder().encode(text))
.map(b => b.toString(2).padStart(8, '0'))
.join(' ');
}
binaryDecode('01001000 01100101 01101100 01101100 01101111'); // "Hello"
binaryEncode('Hi'); // "01001000 01101001"
Python
# Decode: binary string → text
def binary_decode(binary_str: str) -> str:
bits = binary_str.replace(' ', '')
return bytes(
int(bits[i:i+8], 2) for i in range(0, len(bits), 8)
).decode('utf-8')
# Encode: text → binary string (space-grouped)
def binary_encode(text: str) -> str:
return ' '.join(format(b, '08b') for b in text.encode('utf-8'))
print(binary_decode('01001000 01100101 01101100 01101100 01101111')) # Hello
print(binary_encode('Hi')) # 01001000 01101001
PHP
// Decode: binary string → text
function binaryDecode(string $binaryStr): string {
$bits = str_replace(' ', '', $binaryStr);
$chars = array_map(
fn($g) => chr(bindec($g)),
str_split($bits, 8)
);
return implode('', $chars);
}
// Encode: text → binary string (space-grouped)
function binaryEncode(string $text): string {
$bytes = array_map('ord', str_split($text));
return implode(' ', array_map(fn($b) => sprintf('%08b', $b), $bytes));
}
echo binaryDecode('01001000 01100101 01101100 01101100 01101111'); // Hello
echo binaryEncode('Hi'); // 01001000 01101001
Working with hex-encoded data instead? Our hex decoder converts hexadecimal strings to text with the same speed. For JWT token inspection, see the JWT decoder.
Binary vs hexadecimal: when to use each
Binary and hexadecimal represent the same underlying byte values — they are just different notations. The choice depends on what you are doing:
- Use binary when you need to see individual bits — bitmask operations, bitwise logic, flag manipulation, understanding CPU instructions, or teaching how computers work at the lowest level. Binary makes every bit explicit but is verbose: 8 characters per byte.
- Use hexadecimal when you need byte-level inspection with less visual noise — network packet dumps, memory addresses, cryptographic hashes, color codes. Hex is 4× more compact than binary (2 characters per byte) while still mapping directly to bytes.
- Use Base64 when you need to transmit binary data through text channels (email, JSON, URLs) with minimum size overhead. Base64 is 33% larger than the raw binary but far more compact than hex or binary notation.
The easy conversion: every hex digit is exactly 4 binary bits. 48 hex = 0100 1000 binary = H. The bit table in this decoder shows all three representations together so you can learn the patterns visually.
Frequently asked questions
01001000 → 72 → 'H'. This tool does all three steps automatically — paste the binary string and the decoded text appears immediately.
01000001, 'a' = 97 = 01100001, 'H' = 72 = 01001000. Non-ASCII characters (accented letters, emoji, CJK) use 2–4 bytes in UTF-8, so their binary representation is 16–32 bits long.
01001000 = 72 = H, 01100101 = 101 = e, 01101100 = 108 = l, 01101100 = 108 = l, 01101111 = 111 = o. This is one of the most well-known examples of binary text encoding — click the "Hello World" example above to load it directly.
01001000. Use the Swap button to push your decoded output back as input for re-encoding.
One-liner in Python 3:
bits = '01001000 01100101 01101100 01101100 01101111'.replace(' ', '')
text = bytes(int(bits[i:i+8], 2) for i in range(0, len(bits), 8)).decode('utf-8')
print(text) # Hello
To encode: ' '.join(format(b, '08b') for b in text.encode('utf-8'))
48 hex = 0100 1000 binary = 'H'.