Binary → decimal
sum of powersEach digit is worth twice the one to its right. Add up the weights of the 1 bits.
- 12⁵32
- 02⁴16
- 12³8
- 02²4
- 12¹2
- 02⁰1
32 + 8 + 2 = 42
Convert binary to decimal, hex, octal and text instantly, or between any bases from 2 to 36. Free, exact for numbers of any size, and private.
Type in any field and the rest update instantly. Press / to focus, ↑ ↓ to step.
Enter a number above to see its bit-level breakdown.
0010 101042 = 2⁵ + 2³ + 2¹ = 32 + 8 + 2| Width | Binary | Hex | Fits as |
|---|---|---|---|
| 8-bit | 0010 1010 | 0x2A | signed · unsigned |
| 16-bit | 0000 0000 0010 1010 | 0x002A | signed · unsigned |
| 32-bit | 0000 0000 0000 0000 0000 0000 0010 1010 | 0x0000002A | signed · unsigned |
| 64-bit | 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0010 1010 | 0x000000000000002A | signed · unsigned |
UTF-8 encoding, so accents and emoji work too. Edit either side.
BigInt math, so 256-bit hashes convert exactly.
See 8, 16, 32 and 64-bit signed patterns.
Conversions happen on your device. No sign-up.
Click bits to flip them. The highlighted bit is the sign bit for signed values.
Dedicated pages with focused options and a step-by-step explanation of how each result is worked out.
Translate text to binary code and binary back to text, both ways at once.
Turn words, sentences and emoji into 8-bit binary code.
Decode binary code back into readable text, with or without spaces.
Turn ASCII text into 8-bit or 7-bit binary, with every character code shown.
Decode 8-bit or 7-bit binary into ASCII text, control characters included.
Every ASCII code in decimal, hex, octal and binary, with extended ASCII too.
Every letter from A to Z in binary code, in uppercase and lowercase.
Convert base-10 numbers, fractions and negatives to binary.
Find the value of any binary number, with the place values shown.
See a hex value in every base and as text, with signed readings and byte order.
Convert hexadecimal to decimal, with each digit's place value worked out.
Convert decimal numbers to hexadecimal, with every division by 16 shown.
Expand hexadecimal digits into groups of four bits.
Compress long binary strings into short hexadecimal.
Expand base-8 digits into groups of three bits.
Group bits in threes to read them as octal digits.
Encode and decode signed numbers in 8, 16, 32 or 64 bits.
Add, subtract, multiply, divide, AND, OR, XOR, NOT and shift.
Encode text to Base64 and decode Base64 to text, with every 6-bit group shown.
Convert RGB colors to hex codes and hex back to RGB, with every channel in binary.
Work out Linux file permissions in octal, symbolic and binary form.
Find the network, broadcast, host range and mask of any IPv4 subnet, in binary too.
Convert data sizes, speeds, lengths, weights, temperatures and more.
Browse all 23 converters and calculators by category.
Four tools, one page. Here's how to get the most out of each.
Type or paste a number into any field. Prefixes like 0b, 0o and 0x are fine, and spaces or underscores are ignored.
Example:0x2Abecomes42
Open converterBelow the fields you get the bit length, the set bits, the powers-of-two sum and the two's complement pattern for 8 to 64-bit registers.
Example:-1becomes1111 1111
See the detailsWrite text on the left to get its UTF-8 bytes in binary, hex, decimal or octal. Paste bytes on the right to decode them.
Example:Hibecomes01001000 01101001
Convert textToggle bits in an 8, 16 or 32-bit register and watch the unsigned, signed and hex values change. Send the result to the converter.
Example:1000 0000becomes−128
Open playgroundHandy tables and the two methods behind every conversion on this page.
Each digit is worth twice the one to its right. Add up the weights of the 1 bits.
32 + 8 + 2 = 42
Divide by 2 until you reach 0. The remainders, read bottom-up, are the bits.
| Division | Quotient | Remainder |
|---|---|---|
| 42 ÷ 2 | 21 | 0 |
| 21 ÷ 2 | 10 | 1 |
| 10 ÷ 2 | 5 | 0 |
| 5 ÷ 2 | 2 | 1 |
| 2 ÷ 2 | 1 | 0 |
| 1 ÷ 2 | 0 | 1 |
42 = 1010102
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 0 | 0000 | 0 | 0 |
| 1 | 0001 | 1 | 1 |
| 2 | 0010 | 2 | 2 |
| 3 | 0011 | 3 | 3 |
| 4 | 0100 | 4 | 4 |
| 5 | 0101 | 5 | 5 |
| 6 | 0110 | 6 | 6 |
| 7 | 0111 | 7 | 7 |
| 8 | 1000 | 10 | 8 |
| 9 | 1001 | 11 | 9 |
| 10 | 1010 | 12 | A |
| 11 | 1011 | 13 | B |
| 12 | 1100 | 14 | C |
| 13 | 1101 | 15 | D |
| 14 | 1110 | 16 | E |
| 15 | 1111 | 17 | F |
| n | Value | Hex | Note |
|---|---|---|---|
| 2⁰ | 1 | 0x1 | |
| 2¹ | 2 | 0x2 | |
| 2² | 4 | 0x4 | |
| 2³ | 8 | 0x8 | |
| 2⁴ | 16 | 0x10 | nibble |
| 2⁷ | 128 | 0x80 | int8 limit |
| 2⁸ | 256 | 0x100 | byte |
| 2¹⁰ | 1,024 | 0x400 | 1 KiB |
| 2¹⁵ | 32,768 | 0x8000 | int16 limit |
| 2¹⁶ | 65,536 | 0x10000 | uint16 |
| 2²⁰ | 1,048,576 | 0x100000 | 1 MiB |
| 2²⁴ | 16,777,216 | 0x1000000 | RGB |
| 2³⁰ | 1,073,741,824 | 0x40000000 | 1 GiB |
| 2³¹ | 2,147,483,648 | 0x80000000 | int32 limit |
| 2³² | 4,294,967,296 | 0x100000000 | uint32 |
| 2⁵³ | 9,007,199,254,740,992 | 0x20000000000000 | JS safe int |
| 2⁶⁴ | 18,446,744,073,709,551,616 | 0x10000000000000000 | uint64 |
What binary is, how each conversion works, and how to get the most out of these tools.
A binary converter changes numbers from one number system to another, most often between binary (base 2) and the decimal numbers we use every day. This binary converter goes further. It converts binary, decimal, hexadecimal and octal side by side, supports every base from 2 to 36, turns text into binary code and back, and shows the two's complement form a computer uses to store negative numbers. Everything runs in your browser, so results appear as you type and nothing you enter leaves your device.
Binary is a number system with only two digits, 0 and 1. Each digit is called a bit, and each position is worth twice the one to its right: 1, 2, 4, 8, 16, 32 and so on. The binary number 101010 means one 32, no 16, one 8, no 4, one 2 and no 1, which adds up to 42. Eight bits make a byte, which can hold 256 different values, from 0 to 255. Computers use binary because their circuits have two stable states, on and off, which map naturally onto 1 and 0. Every number, letter, image and instruction a computer handles is ultimately stored as a pattern of bits.
To convert binary to decimal, multiply each bit by its place value and add the results. Working from the right, the place values are 2⁰ = 1, 2¹ = 2, 2² = 4 and upward. For 1101, that's 8 + 4 + 0 + 1 = 13. The binary converter at the top of this page does this instantly for numbers of any length and draws the positional breakdown, so you can check each step. For binary fractions such as 1101.101, the positions after the binary point are worth 0.5, 0.25, 0.125 and so on, giving 13.625. The dedicated binary to decimal converter handles fractions exactly and can also read a value as a signed two's complement pattern.
Converting decimal to binary works in reverse. Divide the number by 2, write down the remainder, and repeat with the quotient until it reaches zero. Reading the remainders from bottom to top gives the binary result. For 42, the remainders are 0, 1, 0, 1, 0 and 1, so 42 in binary is 101010. Fractions use a second method: multiply the fractional part by 2 and record the whole-number part each time. Some decimal fractions, such as 0.1, never end in binary and repeat forever, which is why 0.1 + 0.2 isn't exactly 0.3 in most programming languages. The decimal to binary converter shows both methods step by step and marks the repeating bits.
Hexadecimal (base 16) and octal (base 8) are compact ways to write binary. Because 16 is 2⁴, every hex digit stands for exactly four bits, so converting binary to hex is a matter of splitting the bits into groups of four, starting from the right. The binary number 11111111 becomes FF, and 0x2F expands to 0010 1111. Octal works the same way with groups of three bits, because 8 is 2³. Programmers meet hex in memory addresses, byte dumps and color codes such as #FF8000, while octal is still used for Unix file permissions like 755. Use the hex to binary, binary to hex, octal to binary and binary to octal converters to see every digit next to its bits, or the hex converter to turn hex into decimal or text. For a single value with every step shown, try the hex to decimal and decimal to hex converters, and the chmod calculator for file permissions.
Text is stored as numbers too. This binary converter encodes text as UTF-8, the standard used by nearly every website and modern program. Each character becomes one or more bytes, and each byte is shown as eight bits. The letter A is 65, or 01000001, and the word Hi is 01001000 01101001. Accented letters usually take two bytes and most emoji take four, so a single emoji is 32 bits. Try the text to binary converter to see every character's bytes, or paste binary code into the binary to text translator to decode it back into readable text, with or without spaces between the bytes. For plain 7-bit ASCII codes, use the ASCII to binary and binary to ASCII converters, or look a code up in the ASCII table. To translate in both directions at once, use the binary translator.
Mathematically, a negative number in binary simply gets a minus sign: −13 is −1101. Computers, though, store signed whole numbers using two's complement in a fixed number of bits. To find the two's complement of a negative number, write its size in binary, invert every bit and add 1. In 8 bits, 42 is 00101010, the inverted form is 11010101, and adding 1 gives 11010110, which is −42. The converter above shows the 8, 16, 32 and 64-bit patterns for any value, and the two's complement calculator explains every step in both directions. To add, subtract, multiply or divide in binary, or to try AND, OR, XOR, NOT and bit shifts, use the binary calculator.
Students use a binary converter to check computer science, digital electronics and math homework, and to learn how number systems work. Programmers convert values while debugging, writing bit masks, reading register dumps or working with network protocols and file formats. Electronics hobbyists switch between binary and hex when programming microcontrollers. And anyone curious about how computers represent information can type a word into the text to binary converter and see exactly which bits it becomes.
0b, 0o and 0x, and use spaces or underscores to group digits, like 1111_0000.Whether you need a quick binary to decimal conversion, want to translate text into binary code or are learning how two's complement works, this binary converter gives you an exact answer and shows the reasoning behind it.
Quick answers about number bases, two's complement and text encoding.
Give each bit a weight: the rightmost bit is worth 1, the next 2, then 4, 8, 16 and so on. Add up the weights of the bits that are 1.
For example, 101010 is 32 + 8 + 2 = 42. Or just type the binary value into the Binary field and read the Decimal field.
Divide the number by 2 and write down the remainder. Repeat with the quotient until it reaches 0, then read the remainders from bottom to top.
42 gives the remainders 0, 1, 0, 1, 0, 1, so 42 is 101010 in binary. The cheat sheet above walks through every step.
Split the bits into groups of four, starting from the right, and pad the leftmost group with zeros. Each group maps to one hex digit from 0 to F.
101010 becomes 0010 1010, which is 2A. Octal works the same way with groups of three bits.
The input fields use a minus sign, so −42 is shown as -101010 in binary. The fixed-width table shows how the same value is stored in an 8, 16, 32 or 64-bit register using two's complement.
To get the two's complement of a value, invert every bit of its positive form and add 1. In 8 bits, 42 is 00101010, inverting gives 11010101, and adding 1 gives 11010110, which is −42.
Text is encoded as UTF-8 bytes, and each byte is shown in the format you pick. Plain ASCII characters take one byte, so A is 01000001. Accented letters usually take two bytes and most emoji take four.
You can also paste bytes into the right-hand box to decode them. If the bytes don't form valid UTF-8, you'll see a warning and the broken parts show as �.
Any base from 2 to 36. Digits go 0–9 and then a–z, so base 36 uses all ten digits and the whole alphabet. Input isn't case-sensitive, and the Uppercase switch controls how letters are displayed.
You can type the prefixes 0b, 0o and 0x, and use spaces or underscores as separators, like 1111_0000.
Conversions use arbitrary-precision integers, so large values such as 256-bit hashes convert exactly, with no rounding. Each field accepts up to 4,096 characters.
This converter handles whole numbers only. For fractions such as 10.625, use Decimal to Binary or Binary to Decimal.
No. Every conversion runs in your browser, and nothing you type is sent to a server or stored.
The current number is added to the page address (for example ?n=255) so you can bookmark or share it, and anyone you send the link to will see it. Click Clear to remove it.