Binary Converter
Binary 1010 is 10 in decimal. Decimal 255 is 11111111 in binary.
How to use
- Type a number into any of the four boxes: binary, octal, decimal or hex. The other three update right away. A minus sign, spaces, underscores and prefixes such as 0b, 0o and 0x are accepted.
- Tick Group bits in fours to make long binary numbers easier to read.
- To convert text, type it in the Text box and the binary appears in 8-bit groups. Or paste binary into the Binary box and the text appears. Spaces between groups are optional.
How it works
Each box is read digit by digit in its own base and stored as a BigInt, so very large values convert exactly with no rounding. The other boxes are then written out from that one value.
A negative number keeps its minus sign (-1010 is -10), it is not shown as two's complement. For two's complement of a fixed width, take the positive form and invert it yourself.
Text is encoded as UTF-8 first, then each byte is written as 8 bits. Plain English letters take one byte, accented letters and most symbols take two or three, and emoji take four. A binary string decodes back only if its length is a multiple of 8 and the bytes form valid UTF-8.
Common values
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 10 | 1010 | 12 | A |
| 42 | 101010 | 52 | 2A |
| 100 | 1100100 | 144 | 64 |
| 255 | 11111111 | 377 | FF |
| 256 | 100000000 | 400 | 100 |
| 1024 | 10000000000 | 2000 | 400 |
FAQ
How do I convert binary to decimal by hand?
Write the place values 1, 2, 4, 8, 16 and so on from the right, then add up the values where the digit is 1. For 1101 that is 8 + 4 + 1 = 13.
How do I convert decimal to binary?
Divide by 2 again and again and write down each remainder. Read the remainders from the last to the first. For 13: 13 ÷ 2 = 6 r 1, 6 ÷ 2 = 3 r 0, 3 ÷ 2 = 1 r 1, 1 ÷ 2 = 0 r 1, so 13 is 1101.
How do I convert binary to hex?
Split the binary number into groups of 4 bits from the right and replace each group with one hex digit. 1010 1111 becomes AF. Tick Group bits in fours to see the groups.
Why does a letter become 8 binary digits?
Computers store text as bytes, and a byte is 8 bits. The letter A is byte 65, which is 01000001. Characters outside basic English use more than one byte in UTF-8.
Why do I get an error when I paste binary?
The text direction needs only 0 and 1 (spaces and underscores are ignored), a total length that is a multiple of 8, and bytes that form valid UTF-8. A stray digit or a missing bit breaks one of these.
Is there a size limit?
There is no fixed limit for number conversion because it uses BigInt, though very long inputs get slower to type into. Nothing you enter is sent to a server.