How the text boxes turn letters into bytes
Text is first encoded as UTF-8, the encoding used by almost every web page and modern file. Each byte is then written three ways: as eight binary digits, as two hexadecimal digits, and as a decimal number from 0 to 255. Edit any of the four boxes and the other three follow, while the box you are typing in keeps its cursor.
English letters, digits and punctuation take one byte each, so “Hi” is 01001000 01101001. Other characters need more:
- é is two bytes: C3 A9.
- The euro sign € is three bytes: E2 82 AC. So is each Bangla, Hindi or Chinese character.
- Most emoji are four bytes: 😀 is F0 9F 98 80.
The byte count above the boxes shows the total, which is the size the text would take in a UTF-8 file or database column.
Reading eight binary digits by hand
Each position in a byte has a fixed value. From left to right they are 128, 64, 32, 16, 8, 4, 2 and 1. Add up the values where the digit is 1:
0 1 0 0 1 0 0 0
64 8 = 72 → "H"
0 1 1 0 1 0 0 1
64 32 8 1 = 105 → "i"
Hexadecimal is shorter because one hex digit stands for exactly four binary digits. Split 01001000 into 0100 and 1000, which are 4 and 8, and you get 48. That is why programmers read memory, colours and file contents in hex rather than in long runs of 0s and 1s.
When your result differs from another converter
Some converters work on UTF-16 code units, the way JavaScript stores strings, instead of UTF-8 bytes. For plain English the two agree. For é an older tool may print 11101001 (233), its Latin-1 code, where this one prints 11000011 10101001. Both are correct for their encoding, but only the UTF-8 version matches what a web page, an email or a .txt file really contains.
In the binary, hex and decimal boxes, separate the bytes with spaces or commas. Leading zeros are optional, so 1000001 is read as 01000001 (A). A group that cannot be a byte, such as 256 or nine binary digits, gets a message instead of a wrong letter. Bytes that do not form valid UTF-8 show up as �.
Converting a single number between bases
The number converter on the right is separate from the text boxes. Type one whole number in binary, octal, decimal or hex and the others update. There is no size limit: 18446744073709551615 converts to FFFFFFFFFFFFFFFF exactly, a number too large for an ordinary calculator to hold without rounding. Prefixes such as 0b, 0o and 0x are accepted, and spaces or underscores between digit groups are ignored.
Where each base turns up in practice:
- Binary: bit flags, subnet masks (255.255.255.0 is 24 ones followed by 8 zeros) and digital electronics.
- Octal: Unix file permissions. 755 is 111 101 101, read, write and run for the owner and read and run for everyone else.
- Hexadecimal: colour codes such as #FF8800, memory addresses, hashes and Unicode code points.
Negative numbers and fractions are not converted. Computers usually store a negative whole number as two’s complement, where −1 in one byte is 11111111, and the byte width has to be known before that pattern means anything.