Use Text to Binary Converter

Enter your data below to use the Text to Binary Converter

📌 Try these examples:
RESULT

Last updated

Text to Binary Converter Examples

The Text to Binary Converter transforms text into binary representation, showing the binary encoding of each character. Below are practical examples covering ASCII, UTF-8, and common use cases in computer science and programming.

Basic ASCII to Binary

// Each ASCII character = 8 bits (1 byte)
// Format: character → decimal → binary

A → 65  → 01000001
B → 66  → 01000010
C → 67  → 01000011
a → 97  → 01100001
b → 98  → 01100010
z → 122 → 01111010
0 → 48  → 00110000
9 → 57  → 00111001
  → 32  → 00100000  (space)
! → 33  → 00100001

Text to Binary (Space-Separated Bytes)

// Input: "Hello"
H → 01001000
e → 01100101
l → 01101100
l → 01101100
o → 01101111

// Output (space-separated):
01001000 01100101 01101100 01101100 01101111

// Output (continuous):
0100100001100101011011000110110001101111

Full Word Examples

// "Hi"
H = 72  = 01001000
i = 105 = 01101001
Binary: 01001000 01101001

// "OK"
O = 79  = 01001111
K = 75  = 01001011
Binary: 01001111 01001011

// "API"
A = 65  = 01000001
P = 80  = 01010000
I = 73  = 01001001
Binary: 01000001 01010000 01001001

Binary to Text (Reverse Conversion)

// Input binary (space-separated bytes):
01001000 01100101 01101100 01101100 01101111

// Decode each byte:
01001000 = 72  = H
01100101 = 101 = e
01101100 = 108 = l
01101100 = 108 = l
01101111 = 111 = o

// Output: "Hello"

UTF-8 Multi-Byte Encoding

// UTF-8 encoding for non-ASCII characters:
// 1 byte:  0xxxxxxx (U+0000 to U+007F — ASCII range)
// 2 bytes: 110xxxxx 10xxxxxx (U+0080 to U+07FF)
// 3 bytes: 1110xxxx 10xxxxxx 10xxxxxx (U+0800 to U+FFFF)
// 4 bytes: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx (U+10000+)

// é (U+00E9) — 2 bytes in UTF-8:
é → 11000011 10101001

// € (U+20AC) — 3 bytes in UTF-8:
€ → 11100010 10000010 10101100

// 😀 (U+1F600) — 4 bytes in UTF-8:
😀 → 11110000 10011111 10011000 10000000

Binary, Decimal, Hex Comparison

// Three representations of the same values:
Char | Decimal | Hex | Binary
-----|---------|-----|--------
A    |  65     | 41  | 01000001
B    |  66     | 42  | 01000010
Z    |  90     | 5A  | 01011010
a    |  97     | 61  | 01100001
z    | 122     | 7A  | 01111010
0    |  48     | 30  | 00110000
9    |  57     | 39  | 00111001

Bitwise Operations on Characters

// Convert uppercase to lowercase using bitwise OR
// Uppercase A = 01000001
// Lowercase a = 01100001
// Difference:  00100000 (bit 5 = 32)

// Set bit 5 to convert uppercase → lowercase:
'A' | 32 = 'a'   (01000001 | 00100000 = 01100001)
'B' | 32 = 'b'   (01000010 | 00100000 = 01100010)

// Clear bit 5 to convert lowercase → uppercase:
'a' & ~32 = 'A'  (01100001 & 11011111 = 01000001)

// Check if character is uppercase:
char & 32 === 0  // true if uppercase

HTTP Method in Binary (Network Protocol)

// "GET" as ASCII binary (what appears in network packets):
G = 71  = 01000111
E = 69  = 01000101
T = 84  = 01010100

Binary: 01000111 01000101 01010100
Hex:    47 45 54

// "POST":
P = 80  = 01010000
O = 79  = 01001111
S = 83  = 01010011
T = 84  = 01010100

Binary: 01010000 01001111 01010011 01010100

JavaScript Binary Conversion

// Text to binary
function textToBinary(text) {
  return [...text]
    .map(char => char.codePointAt(0).toString(2).padStart(8, '0'))
    .join(' ');
}

// Binary to text
function binaryToText(binary) {
  return binary.split(' ')
    .map(byte => String.fromCharCode(parseInt(byte, 2)))
    .join('');
}

textToBinary("Hi")    // "01001000 01101001"
binaryToText("01001000 01101001")  // "Hi"

// Get binary of a character
'A'.charCodeAt(0).toString(2).padStart(8, '0')  // "01000001"

Python Binary Conversion

// Text to binary
def text_to_binary(text):
    return ' '.join(format(ord(c), '08b') for c in text)

// Binary to text
def binary_to_text(binary):
    return ''.join(chr(int(b, 2)) for b in binary.split())

text_to_binary("Hello")   # "01001000 01100101 01101100 01101100 01101111"
binary_to_text("01001000 01101001")  # "Hi"

// Single character
bin(ord('A'))   # '0b1000001'
format(ord('A'), '08b')  # '01000001'

Common Use Cases

Enter your text in the converter to see the binary encoding of each character, or paste binary to decode it back to text.

Frequently Asked Questions

Simply enter your data, click the process button, and get instant results. All processing happens in your browser for maximum privacy and security.

Yes! Text to Binary Converter is completely free to use with no registration required. All processing is done client-side in your browser.

Absolutely! All processing happens locally in your browser. Your data never leaves your device, ensuring complete privacy and security.