Binary translator

UTF-8 and ASCII

Type text to get binary code, or paste 0s and 1s to read them. Switch to hex, decimal or octal, and see exactly which bits make up each character.

Try:
Every character as bitsColoured bits tell UTF-8 how many bytes belong to the character.
H0100100072
i01101001105
How it works

How text becomes binary code

A computer stores every character as a number, and every number as bits: zeros and ones. Eight bits make a byte, which can hold a value from 0 to 255.

For A–Z, digits and punctuation the number comes from ASCII: H is 72, i is 105. Written with eight bits that is 01001000 01101001. Characters beyond ASCII, like ä, € or emoji, need two to four bytes in UTF-8, the encoding the web uses.

CharacterNumber (Unicode)UTF-8 bytes in binaryBytes
HU+0048 (72)010010001
iU+0069 (105)011010011
äU+00E4 (228)11000011 101001002
€U+20AC (8364)11100010 10000010 101011003
😀U+1F600 (128512)11110000 10011111 10011000 100000004
Binary alphabet

The alphabet in binary

Capital and small letters differ in a single bit: the third from the left (value 32). Click a letter to add it to the translator.

LetterBinaryDecimalHex
010000016541
010000106642
010000116743
010001006844
010001016945
010001107046
010001117147
010010007248
010010017349
01001010744A
01001011754B
01001100764C
01001101774D
01001110784E
01001111794F
010100008050
010100018151
010100108252
010100118353
010101008454
010101018555
010101108656
010101118757
010110008858
010110018959
01011010905A
LetterBinaryDecimalHex
011000019761
011000109862
011000119963
0110010010064
0110010110165
0110011010266
0110011110367
0110100010468
0110100110569
011010101066A
011010111076B
011011001086C
011011011096D
011011101106E
011011111116F
0111000011270
0111000111371
0111001011472
0111001111573
0111010011674
0111010111775
0111011011876
0111011111977
0111100012078
0111100112179
011110101227A
Words in binary

Common words in binary code

Click a word to open it in the translator.

ASCII table

ASCII table with binary, decimal and hex

All 128 ASCII characters. Codes 0 to 31 and 127 are control characters such as line feed (LF) and tab. UTF-8 stores these 128 characters in exactly one byte, the same as ASCII.

DecHexBinaryChar
00000000000NUL
10100000001SOH
20200000010STX
30300000011ETX
40400000100EOT
50500000101ENQ
60600000110ACK
70700000111BEL
80800001000BS
90900001001TAB
100A00001010LF
110B00001011VT
120C00001100FF
130D00001101CR
140E00001110SO
150F00001111SI
161000010000DLE
171100010001DC1
181200010010DC2
191300010011DC3
201400010100DC4
211500010101NAK
221600010110SYN
231700010111ETB
241800011000CAN
251900011001EM
261A00011010SUB
271B00011011ESC
281C00011100FS
291D00011101GS
301E00011110RS
311F00011111US
DecHexBinaryChar
322000100000Space
332100100001!
342200100010"
352300100011#
362400100100$
372500100101%
382600100110&
392700100111'
402800101000(
412900101001)
422A00101010*
432B00101011+
442C00101100,
452D00101101-
462E00101110.
472F00101111/
4830001100000
4931001100011
5032001100102
5133001100113
5234001101004
5335001101015
5436001101106
5537001101117
5638001110008
5739001110019
583A00111010:
593B00111011;
603C00111100<
613D00111101=
623E00111110>
633F00111111?
DecHexBinaryChar
644001000000@
654101000001A
664201000010B
674301000011C
684401000100D
694501000101E
704601000110F
714701000111G
724801001000H
734901001001I
744A01001010J
754B01001011K
764C01001100L
774D01001101M
784E01001110N
794F01001111O
805001010000P
815101010001Q
825201010010R
835301010011S
845401010100T
855501010101U
865601010110V
875701010111W
885801011000X
895901011001Y
905A01011010Z
915B01011011[
925C01011100\
935D01011101]
945E01011110^
955F01011111_
DecHexBinaryChar
966001100000`
976101100001a
986201100010b
996301100011c
1006401100100d
1016501100101e
1026601100110f
1036701100111g
1046801101000h
1056901101001i
1066A01101010j
1076B01101011k
1086C01101100l
1096D01101101m
1106E01101110n
1116F01101111o
1127001110000p
1137101110001q
1147201110010r
1157301110011s
1167401110100t
1177501110101u
1187601110110v
1197701110111w
1207801111000x
1217901111001y
1227A01111010z
1237B01111011{
1247C01111100|
1257D01111101}
1267E01111110~
1277F01111111DEL
By hand

Convert binary to decimal by hand

Each position in a binary number is worth twice the one to its right: 1, 2, 4, 8, 16, 32 … Write the place values over the bits and add up those with a 1.

25321
24160
2381
2241
2120
2011
= 32 + 8 + 4 + 1 = 45

The other way round, divide the decimal number by 2 again and again and note the remainders. Read from bottom to top, they are the binary number.

45 ÷ 2= 22remainder 1
22 ÷ 2= 11remainder 0
11 ÷ 2= 5remainder 1
5 ÷ 2= 2remainder 1
2 ÷ 2= 1remainder 0
1 ÷ 2= 0remainder 1

↑ 45 = 101101

Hex is the shortcut programmers use: four bits are exactly one hex digit, so a byte is always two hex digits.

000000
000111
001022
001133
010044
010155
011066
011177
100088
100199
1010A10
1011B11
1100C12
1101D13
1110E14
1111F15
Use it in code

Text to binary in Python, JavaScript and PHP

Each example turns “Hi” into binary and back, using only the standard library.

Python
text = "Hi"
binary = " ".join(format(b, "08b") for b in text.encode("utf-8"))
print(binary)  # 01001000 01101001

back = bytes(int(x, 2) for x in binary.split()).decode("utf-8")
print(back)  # Hi
JavaScript
const text = "Hi";
const binary = [...new TextEncoder().encode(text)]
  .map((b) => b.toString(2).padStart(8, "0")).join(" ");
console.log(binary); // 01001000 01101001

const back = new TextDecoder().decode(
  Uint8Array.from(binary.split(" "), (x) => parseInt(x, 2)));
console.log(back); // Hi
PHP
<?php
$text = "Hi";
$binary = implode(" ", array_map(fn($b) => sprintf("%08b", $b), unpack("C*", $text)));
echo $binary, "\n"; // 01001000 01101001

$back = implode("", array_map(fn($x) => chr(bindec($x)), explode(" ", $binary)));
echo $back, "\n"; // Hi
Command line
# Binary number to decimal and back (bash, bc)
echo $((2#101101))        # 45
echo "obase=2; 45" | bc   # 101101

# Text to binary, one byte per group
echo -n "Hi" | xxd -b     # 00000000: 01001000 01101001  Hi
FAQ

Questions about binary code

How do I translate binary to text?

Paste the 0s and 1s into the right-hand box and the text appears on the left. Groups of eight bits separated by spaces work best; a long run without spaces is split into bytes automatically. Hex and decimal codes are recognised too.

What does 01001000 01101001 mean?

It means “Hi”. 01001000 is 72, the ASCII code of H, and 01101001 is 105, the code of i.

What is “I love you” in binary?

“I love you” in binary is 01001001 00100000 01101100 01101111 01110110 01100101 00100000 01111001 01101111 01110101. Every character, including the spaces, is one byte.

How many bits are in a byte?

Eight. A byte can hold 2⁸ = 256 different values, 0 to 255. Original ASCII only needs seven bits, which is why you sometimes see 7-bit groups; the tool reads both.

Why does ä or € need more than 8 bits?

ASCII only covers 128 characters. UTF-8 stores everything else in two to four bytes: ä is 11000011 10100100, € is three bytes and most emoji four. The coloured bits above show how UTF-8 marks them.

How do I convert binary to decimal?

Add the place values of all the 1s. Reading from the right, the places are worth 1, 2, 4, 8, 16, 32 and so on, so 101101 is 32 + 8 + 4 + 1 = 45. The Numbers tab shows the steps for any number.

What is the difference between binary and hex?

They show the same bits. Binary writes each bit, hex groups four bits into one digit from 0 to F. 01001000 in binary is 48 in hex and 72 in decimal.

Is binary code a kind of encryption?

No. Binary is just another way to write the same data, and anyone can read it with a translator like this one. To keep a message secret it has to be encrypted, for example with AES.

Is my text sent anywhere?

No. The translation runs in your browser. Nothing you type is sent or stored.

Searches the list of pages on this site. What you type stays in your browser.