Binary Translator

Conversion runs entirely in your browser. No data is uploaded, logged, or stored.

What is Binary?

Binary is a base-2 number system that uses only two digits: 0 and 1. Every piece of data a computer processes β€” text, images, audio, programs β€” is ultimately stored as a sequence of these two values. A single binary digit is called a bit; eight bits form a byte, which can represent 256 different values (28 = 256). The letter "A" in ASCII is the byte 01000001, which is the number 65 in decimal.

Binary exists because digital circuits are built from transistors that have two states: on and off. The entire stack β€” from logic gates to processors to programming languages β€” rests on this foundation. Understanding binary is not just academic; it appears in debugging, networking, file formats, and permissions.

How Text-to-Binary Translation Works

Converting text to binary is a two-step process. First, each character is mapped to a number using a character encoding β€” ASCII for English letters and symbols, UTF-8 for everything else including emoji and accented characters. Second, each number is converted to its binary representation, padded to 8 bits per byte.

For ASCII characters (codes 0-127), each character is exactly one byte. The letter "H" is 72 in decimal, which is 01001000 in binary. The word "Hi" becomes 01001000 01101001 β€” two bytes, 16 bits.

For characters outside ASCII β€” accented letters, CJK characters, emoji β€” UTF-8 uses multiple bytes per character. The emoji πŸš€ is four bytes in UTF-8: 11110000 10011111 10011010 10000000. This tool handles UTF-8 automatically, so emoji and international text convert correctly. This is the same UTF-8 encoding step that matters in Base64 encoding and hashing β€” get the encoding wrong and the output is wrong.

ASCII Table β€” Printable Characters

DecBinaryCharDecBinaryCharDecBinaryChar
3200100000(space)6401000000@9601100000`
3300100001!6501000001A9701100001a
3400100010"6601000010B9801100010b
3500100011#6701000011C9901100011c
3600100100$6801000100D10001100100d
3700100101%6901000101E10101100101e
3800100110&7001000110F10201100110f
480011000007101000111G10301100111g
490011000117201001000H10401101000h
500011001027301001001I10501101001i
510011001137401001010J10601101010j
520011010047501001011K10701101011k
530011010157601001100L10801101100l
540011011067701001101M10901101101m
550011011177801001110N11001101110n
560011100087901001111O11101101111o
570011100198001010000P11201110000p

Binary in Programming

Binary is not just a theoretical concept β€” it shows up directly in everyday programming:

How to Convert in Code

JavaScript

// Text to binary
const binary = [...new TextEncoder().encode("Hello")]
  .map(b => b.toString(2).padStart(8, "0")).join(" ");

// Binary to text
const text = new TextDecoder().decode(
  new Uint8Array("01001000 01101001".split(" ")
    .map(b => parseInt(b, 2)))
);

Python

# Text to binary
binary = ' '.join(format(b, '08b') for b in "Hello".encode('utf-8'))

# Binary to text
text = bytes(int(b, 2) for b in "01001000 01101001".split()).decode('utf-8')

Bash

# Text to binary (one byte per line)
echo -n "Hello" | xxd -b | cut -d' ' -f2-7

# Binary to text
echo "01001000 01101001" | perl -lape '$_=pack"B*",join"",@F'

Encoding Matters: ASCII vs UTF-8

ASCII maps 128 characters to the numbers 0-127, each fitting in a single byte. It covers English letters, digits, punctuation, and control characters. For decades this was sufficient, but it cannot represent accented characters, Chinese, Arabic, or emoji.

UTF-8 is a variable-length encoding that is backward-compatible with ASCII: characters 0-127 are identical. Characters above 127 use 2-4 bytes, with leading bits that indicate the byte count. This is why "Γ©" is two bytes in UTF-8 (11000011 10101001) but one byte in Latin-1 (11101001). This tool uses UTF-8, which is the encoding of the modern web β€” over 98% of websites use it.

Common Binary Prefixes

PrefixSymbolBytesDecimal approx.
KilobyteKB1,024~1 thousand
MegabyteMB1,048,576~1 million
GigabyteGB1,073,741,824~1 billion
TerabyteTB1,099,511,627,776~1 trillion

The discrepancy between binary (1 KB = 1,024 bytes) and decimal (1 kB = 1,000 bytes) definitions is why a "500 GB" hard drive shows as 465 GB in your operating system. Storage manufacturers use decimal; operating systems use binary. The IEC introduced unambiguous prefixes β€” kibibyte (KiB), mebibyte (MiB) β€” but adoption remains inconsistent.

Binary and Other Number Bases

Binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16) are different ways to represent the same numbers. Programmers use hex because each hex digit maps to exactly four bits, making it a compact way to write binary:

BinaryDecimalOctalHex
0000000
0001111
0101555
10101012A
11111517F
11111111255377FF

This is why hash outputs are displayed in hex rather than binary β€” a SHA-256 digest is 256 bits, which is 64 hex characters instead of 256 binary digits.

Two's Complement β€” How Computers Store Negative Numbers

Computers represent negative integers using two's complement. To negate a number: flip every bit and add 1. In an 8-bit system, 00000101 is +5 and 11111011 is βˆ’5. The leading bit acts as a sign indicator: 0 for positive, 1 for negative. This system has a useful property β€” addition works the same for positive and negative numbers, so the processor does not need separate circuits for subtraction.

Frequently Asked Questions

Is my data sent to a server?
No. All conversion runs in your browser using JavaScript. Nothing is transmitted, logged, or stored.
Why does my emoji produce more than 8 bits?
Because emoji are multi-byte characters in UTF-8. A single emoji like πŸš€ is 4 bytes (32 bits). This tool uses UTF-8 encoding, which is the standard on the modern web and handles all Unicode characters correctly.
What separators can I use between bytes?
The tool supports spaces (the default and most readable), no separator (a continuous stream of 0s and 1s), and newlines (one byte per line). When decoding binary back to text, all non-binary characters (anything that is not 0 or 1) are stripped automatically, so any separator works on input.
What if my binary string is not a multiple of 8 bits?
The tool reports an error. Each byte is 8 bits, so valid binary text must have a total number of 0s and 1s divisible by 8. The error message tells you how many bits are missing.
Is binary the same as machine code?
Not exactly. Machine code is binary instructions that a specific processor understands, but not all binary is machine code. Text, images, and data files are also stored in binary. Machine code is the subset of binary that encodes executable instructions for a particular CPU architecture.
How is binary related to Base64?
Base64 is an encoding that converts binary data (arbitrary bytes) into text using 64 printable characters. It exists because some transport layers β€” email, URLs, JSON β€” cannot carry raw binary safely. Our Base64 encoder performs that conversion.