Binary Converter

A binary converter rewrites a number between base 2, base 8, base 10 and base 16. To go from decimal to binary, divide by 2 repeatedly and read the remainders upward: 156 = 10011100. Reversing it, add the place values 128+16+8+4 to get 156 back.

Presets
Invalid input
Bit Visualization

Lines written with only 0 and 1 were read as decimal. Pick Binary above, or prefix them with 0b, to read them as bits.

Embed this tool on your website

× px

                        

💡 Integration Tip

Copy the embed code and paste it into your website HTML. The responsive version adapts to all screen sizes automatically.

0 ratings

How do you convert decimal to binary by hand?

Divide the decimal number by 2, write the remainder, then divide the quotient by 2 again and repeat until the quotient reaches 0. Reading the remainders from the bottom up gives the binary string. Here is 156 worked all the way down; the remainder column read upward is 10011100.

Division Quotient Remainder (bit)
156 ÷ 2 78 0
78 ÷ 2 39 0
39 ÷ 2 19 1
19 ÷ 2 9 1
9 ÷ 2 4 1
4 ÷ 2 2 0
2 ÷ 2 1 0
1 ÷ 2 0 1

Read the remainder column from the last row to the first: 1, 0, 0, 1, 1, 1, 0, 0 — so 156 in binary is 10011100.

How do you convert binary to decimal?

Each bit carries a place value that doubles from right to left. Write the weights above the bits and add the weights that sit over a 1. In 10011100 the 1s stand over 128, 16, 8 and 4, and 128 + 16 + 8 + 4 = 156.

Bit position Place value Bit in 10011100 Adds
2⁷ 128 1 128
2⁶ 64 0 0
2⁵ 32 0 0
2⁴ 16 1 16
8 1 8
4 1 4
2 0 0
2⁰ 1 0 0
128 + 16 + 8 + 4 156

Binary, decimal, octal and hexadecimal conversion chart

The first sixteen values are the ones worth memorising, because one hexadecimal digit is exactly four bits. The landmark rows below them are the boundaries you meet in real code: a full byte, a signed byte, two bytes and a kibibyte (1024 bytes).

Decimal Binary Octal Hexadecimal
0 0 0 0
1 1 1 1
2 10 2 2
3 11 3 3
4 100 4 4
5 101 5 5
6 110 6 6
7 111 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
16 10000 20 10
32 100000 40 20
64 1000000 100 40
100 1100100 144 64
127 1111111 177 7F
128 10000000 200 80
255 11111111 377 FF
256 100000000 400 100
1024 10000000000 2000 400
65535 1111111111111111 177777 FFFF

How do you convert binary to hexadecimal and octal?

Group the bits instead of doing arithmetic. For hexadecimal take four bits at a time from the right, padding the left with zeros: 110110111 becomes 0001 1011 0111 = 1B7. For octal take three bits at a time: 110 110 111 = 667. Both equal 439 in decimal, and both conversions run the other way by expanding each digit back into its group of bits.

How does binary convert to text and ASCII?

Characters are stored as numbers, so binary becomes text in two steps: split the stream into 8-bit bytes, then look each byte up in the character table. RFC 20 fixes the classic 7-bit ASCII codes that UTF-8 still reuses for English, so 01001000 01101001 is 72 105, which spells "Hi".

Character ASCII code Binary Hexadecimal
(space) 32 00100000 20
0 48 00110000 30
A 65 01000001 41
H 72 01001000 48
a 97 01100001 61
i 105 01101001 69

How do you write an IP address in binary?

An IPv4 address is four 8-bit octets, so convert each number separately and pad every one to eight bits. 192.168.1.1 becomes 11000000.10101000.00000001.00000001. The padding is what makes prefixes readable: a /24 mask keeps the first 24 bits, which is 255.255.255.0, and a /27 mask ends mid-octet at 224 = 11100000.

How are negative numbers stored in binary?

Almost every processor uses two’s complement: write the positive value, flip every bit, then add 1. For −5 in eight bits, 00000101 flips to 11111010 and becomes 11111011. The leftmost bit acts as the sign, so an 8-bit signed range is −128 to 127 while the same 8 bits unsigned run 0 to 255. This converter works in unsigned whole numbers, so type 251 to see the bit pattern of −5.

Sources

The character codes, binary prefixes and address formats used on this page come from these specifications.

About Binary Converter

This binary converter keeps decimal, binary, octal and hexadecimal in view at the same time. Type into whichever field matches the number you already have and the other three rewrite themselves on the keystroke, so you never have to decide in advance which direction you are converting. Arithmetic is done in arbitrary precision, so a 64-bit register value survives the round trip intact: FFFFFFFFFFFFFFFF comes back as 18446744073709551615, not as a rounded 18446744073709552000. The bit strip underneath pads the value to 8, 16, 32 or 64 bits — above 64 bits it pads to the next whole byte, so a 65-bit value is drawn as 72 — states the width it used and highlights every 1, which is usually faster than counting zeros when you are checking a mask or a flag byte.

Input is validated per base rather than silently truncated. A stray 2 typed into the binary field, or a G in the hexadecimal field, raises a clear error instead of quietly converting the part of the string that happened to be legal — the failure mode that makes naive converters give confidently wrong answers. Below the single converter there is a bulk panel. Paste a column of values straight out of a log, a spreadsheet or a register dump, tell it which base they are written in, and it returns a table with all four bases, the base each line was read in, and the ASCII character for every byte in the printable range.

Auto-detect understands the 0x, 0b and 0o prefixes; a bare string of 0s and 1s is read as decimal and flagged, so nothing is guessed behind your back. The result copies as tab-separated text that lands neatly in Excel, Google Sheets or Numbers, and downloads as a CSV that keeps your original input in the first column so a reviewer can audit each row. The reference material is written for people who have to show their working: the division-by-2 remainder table for 156, the place-value table for 10011100, a chart of the first sixteen values plus the landmark ones (255, 256, 1024, 65535), the four-bit grouping trick that turns binary into hex, an ASCII sample, and how an IPv4 address and a two’s-complement negative look in bits.

Conversion happens inside this page: the values you paste are never uploaded, which is what makes the tool usable on addresses, keys and customer identifiers that are not supposed to reach a third-party server.

Use Cases

Reading a hex dump: turn 0x1F4 from a debugger or packet capture into 500 decimal without leaving the browser.
Checking a bitmask: see which of the eight bits in 10110010 are set before you write the & and | logic.
Subnetting: convert an octet such as 224 to 11100000 to see exactly where a /27 mask splits the range.
Unix permissions: confirm that chmod 640 really is 110 100 000 before you apply it to a production file.
Computer-science homework: check a decimal-to-binary answer, then copy the division-by-2 table to show the working.

How do I use this binary converter step by step?

1

Type your value into the field that matches the base you already have — decimal, binary, octal or hexadecimal — or press a preset such as 255.

2

The other three fields update on every keystroke. An illegal digit for that base, such as a 2 inside a binary number, shows an error instead of a wrong result.

3

Check the bit strip below the fields: it pads the value to 8, 16, 32 or 64 bits (to the next whole byte above that) and highlights each 1.

4

Copy a single field with the icon beside its label, or press Copy to take all four bases at once.

5

To convert many numbers, open the bulk panel, paste one value per line, choose the base they are written in and press Convert list.

6

Copy the bulk table into a spreadsheet, or download it as CSV to attach to a ticket or a report.

Pro Tips

  • Read binary in groups of four: 11011110 is 1101 1110, which is DE in hex and 222 in decimal.
  • Paste hexadecimal straight from a debugger without the 0x prefix; A–F is accepted in either case and is normalised to uppercase when you leave the field.
  • The bit strip pads the value to 8, 16, 32 or 64 bits — and, above 64 bits, to the next whole byte — then states the width it used, so you can see at a glance how many bytes a value needs.
  • The presets are the limits you hit most: 255 fills one byte, 65535 two bytes, and 2147483647 is the largest signed 32-bit integer.
  • For a list of values use the bulk panel and download the CSV — it keeps your original input in the first column so the conversion can be audited.

Frequently Asked Questions

Divide the decimal number by 2 and write down the remainder, then divide the quotient by 2 again, and keep going until the quotient is 0. Read the remainders from the last one back to the first. For 156 the remainders come out 0, 0, 1, 1, 1, 0, 0, 1, so 156 in binary is 10011100.

Give each bit a place value that doubles from right to left — 1, 2, 4, 8, 16, 32, 64, 128 — then add the values that sit over a 1. In 11010110 the 1s stand over 128, 64, 16, 4 and 2, so the number is 214. The converter above does the same sum the moment you type.

A byte is 8 bits. Eight bits give 2⁸ = 256 different patterns, so an unsigned byte counts from 0 (00000000) to 255 (11111111). Sixteen bits reach 65,535 and a signed 32-bit integer stops at 2,147,483,647. All three of those numbers sit in the presets above because they are the ceilings you run into most often.

Because one hex digit is exactly four bits, so conversion is grouping rather than arithmetic: 11011110 splits into 1101 1110 = DE. A byte is always two hex digits, an RGBA colour is eight, and a MAC address is twelve — all far easier to read and type than 8, 32 or 48 zeros and ones.

Text is stored as numbers. Split the binary into 8-bit bytes, convert each byte to decimal, then look the number up in the ASCII table defined by RFC 20: 01001000 is 72, the letter H. So 01001000 01101001 spells "Hi". The bulk panel shows the ASCII character next to every byte in the printable 32–126 range.

Octal groups bits in threes, which is why Unix file permissions use it: chmod 755 is 111 101 101, meaning read/write/execute for the owner and read/execute for group and others. Octal also survives in C escape sequences and older hardware manuals. Type any value above and the octal field updates alongside the other bases.

With two’s complement: write the positive value, flip every bit, then add 1. For −5 in eight bits, 00000101 becomes 11111010, and adding 1 gives 11111011. The leftmost bit acts as the sign, so 8-bit signed values run from −128 to 127. This converter handles unsigned whole numbers, so enter 251 to see that bit pattern.

Yes. Open the bulk panel under the converter, paste up to 200 values — one per line — choose the base you are pasting, and every line is converted to decimal, binary, octal and hexadecimal in one table. Auto-detect reads the 0x, 0b and 0o prefixes. Copy the table into a spreadsheet or download it as CSV.

Convert each of the four decimal octets separately and pad each result to eight bits. 192.168.1.1 becomes 11000000.10101000.00000001.00000001. That padding is what makes subnet masks readable: /24 keeps the first 24 bits, which is 255.255.255.0, while /27 stops mid-octet at 224 = 11100000.

It depends on the prefix. NIST and IEC 80000-13 define a kibibyte (KiB) as 1024 bytes and keep the kilobyte (kB) at 1000. Drive makers advertise in decimal, while operating systems often display the binary value, which is why a 1 TB disk shows as roughly 931 GB once it is formatted.

Popular Tools

No more tools to show
Explore All Tools
FreeWebTools AI
Powered by free AI models · Full chat →