Skip to content
OverCalculator
  1. Home
  2. Conversion
  3. Binary Converter
Conversion

Binary Converter

Convert arbitrary-size unsigned integers among binary, octal, decimal, and hexadecimal with exact arithmetic and pair-specific outputs.

Published

Converted number
Decimal (base 10)
45
Binary
10 1101
Decimal
45
Hexadecimal
2D
Octal
55
Bit length
6

Binary 101101 equals decimal 45.

Source notation
Convert binary to
Use only 0 and 1. Spaces and underscores are ignored.

Results update as you type.

Binary Converter

Binary is a way of writing an integer, not a mysterious second kind of math. The Binary Converter on this page treats the entered value as an unsigned whole number and shows the same quantity in base 2, base 10, base 16, and base 8. That makes it a hub for students learning positional notation, programmers checking a bit mask, makers copying values from a microcontroller data sheet, and anyone who wants to see how one number looks through several digital notations.

This page is intentionally different from a storage-unit converter. A binary number such as 101101 is an encoding of the integer forty-five. A file size such as 45 MB is a measurement with units. If your task is storage capacity or data plans, use the digital storage converter, kB to MB converter, or MB to GB converter. If your task is specifically grouping base-2 digits into base 8, the binary to octal converter focuses on that one algorithm.

How to use the converter

Choose Binary to other bases to enter a string made only of zeros and ones. Spaces and underscores are ignored, so 1011 0101, 10110101, and 1011_0101 are treated as the same digits. Choose Decimal to binary to enter a nonnegative decimal integer with digits 0 through 9. The converter then returns a primary answer plus a reference panel containing the binary, decimal, hexadecimal, octal, and bit length.

The calculator does not interpret prefixes, fractional points, byte arrays, signs, or two’s-complement widths. That restraint is important. The text 11111111 can mean 255 as an unsigned integer, -1 in an 8-bit signed two’s-complement field, or a byte whose meaning depends on a file format. This tool answers the first question only: what integer does this positional notation represent?

Positional notation in base 2

Decimal is base 10 because each place is worth a power of ten. Binary is base 2 because each place is worth a power of two. The rightmost binary digit is the ones place, the next is twos, then fours, eights, sixteens, thirty-twos, and so on. A digit may only be 0 or 1, so each place is either absent or present.

For binary digits read from right to left, the decimal value is:

decimal value=i=0n1biti  × 2i\text{decimal value} = \sum_{i=0}^{n-1} \text{bit}_{i}\ \text{ } \times \text{ } 2^i

To convert the other way, divide the decimal number by 2 repeatedly and keep the remainders, or find the largest power of two that fits, subtract it, and continue downward. The repeated-division method is mechanical; the place-value method is often easier for small values because powers such as 1, 2, 4, 8, 16, 32, 64, and 128 become familiar quickly.

Binary example

The default binary input is 101101. The calculator first removes grouping characters, validates that every digit is 0 or 1, and evaluates the positions:

1×25+0×24+1×23+1×22+0×21+1×20=451 \times 2^5 + 0 \times 2^4 + 1 \times 2^3 + 1 \times 2^2 + 0 \times 2^1 + 1 \times 2^0 = 45

So the primary result in binary-to-other mode is 45 decimal. The binary display is grouped as 10 1101, because the converter groups binary from the left in sets of four for readability. The same integer is 2D in hexadecimal, 55 in octal, and has a bit length of 6 because six binary digits are needed to write it without leading zeros.

Switch to decimal-to-binary mode and enter 45; the primary result becomes 10 1101, and the side panel still shows decimal 45, hexadecimal 2D, octal 55, and bit length 6. The value did not change. Only the alphabet and base used to write it changed.

Why hexadecimal and octal appear beside binary

Hexadecimal is base 16, so one hex digit covers four binary bits. Octal is base 8, so one octal digit covers three binary bits. That alignment is why 1111 1111 becomes FF in hex and 377 in octal without changing the underlying value. In modern programming, hexadecimal is common for colors, memory addresses, masks, Unicode code points, checksums, and bytes. Octal appears less often, but it still shows up in Unix permissions and older digital-system notation.

Use the decimal to hexadecimal converter when you want a dedicated explanation of base 16, the decimal to octal converter for base 8, and the binary to hexadecimal calculator for four-bit grouping.

Binary and octal conversion

Choose a binary source and an octal destination, or reverse the pair with an octal source and binary destination. Binary and octal align exactly because 8 = 2^3: each octal digit corresponds to three bits. Group binary digits from the right, padding only the leftmost group when necessary.

For example, 110110001010 groups as 110 110 001 010. Those groups map to octal digits 6 6 1 2, so:

1101100010102=66128=346610110110001010_2 = 6612_8 = 3466_{10}

The reverse uses octal place values. For 6612, 6 × 8^3 + 6 × 8^2 + 1 × 8 + 2 = 3466, which returns binary 110110001010. Inputs are unsigned whole numbers; digits 8 and 9 are invalid in octal, and grouping characters do not affect value. Octal remains useful for Unix permission notation and for reading bit fields in three-bit groups, but the converter reports numeric equivalence rather than interpreting permission semantics.

Decimal and hexadecimal conversion

For the decimal-to-hexadecimal preset, hexadecimal is the primary result. Hex uses powers of 16 and digits 09 plus AF, where A through F represent 10 through 15. Repeated division by 16 produces the hexadecimal digits; reversing the direction expands those place values:

25510=FF16255_{10} = FF_{16}

F×161+F×160=15×16+15=255F \times 16^1 + F \times 16^0 = 15 \times 16 + 15 = 255

Hexadecimal is a compact notation for binary data, colors, masks, addresses, and checksums. This converter treats the entry only as an unsigned integer: it does not interpret a color channel layout, memory address, signed machine word, prefix, fraction, or text encoding. The width-preserving hexadecimal-to-binary mode remains available when leading hexadecimal zeroes must each expand to a four-bit nibble.

Decimal and octal conversion

For decimal to octal, divide repeatedly by 8 and read the remainders from last to first. In the other direction, multiply each octal digit by its power of eight. The worked pair 42 and 52 demonstrates both rules:

42=5×8+24210=52842 = 5 \times 8 + 2 \quad\Longrightarrow\quad 42_{10} = 52_8

528=5×81+2×80=421052_8 = 5 \times 8^1 + 2 \times 8^0 = 42_{10}

Only unsigned whole numbers are accepted. An octal input may contain only 0 through 7; decimal points, signs, prefixes, and signed-word interpretations are outside this calculator’s scope. Conversion is exact integer notation, not a measurement conversion, so there is no physical factor or intermediate rounding.

Exactness and large integers

All four bases are parsed digit by digit with integer arithmetic and converted without floating-point arithmetic. That keeps large values exact. Commas and spaces are display grouping only, and the ungrouped value remains available in copied output. Leading hexadecimal zeroes are preserved only by the explicit width-preserving mode; otherwise leading zeroes do not change the integer.

Reference table

DecimalBinaryHexadecimalOctalNotes
0000Zero has one displayed digit here
1111Smallest nonzero bit
21022One two and no ones
711177Largest single octal digit
81000810First four-bit binary place
151111F17Largest single hex digit
16100001020First two-digit hex value
451011012D55Default example
25511111111FF377One byte when unsigned
1024100000000004002000Two to the tenth power

Common pitfalls

  • Do not read a binary-looking string as decimal. 1000 in binary is eight, not one thousand.
  • Do not add a decimal point unless you have a method for fractional binary; this calculator is for integers.
  • Do not assume a leading zero is meaningless in every context. It is meaningless for the integer value, but meaningful in fixed-width codes, protocol fields, and display formats.
  • Do not treat unsigned conversion as signed interpretation. A signed byte requires a width and a rule.
  • Do not mix number bases with storage prefixes. Powers of two are used in both areas, but base conversion and byte-unit conversion are separate tasks.

Sources

Octal, hexadecimal, grouping, and width examples on this page are publisher-derived positional arithmetic: 8=2^3 and 16=2^4, so an octal digit maps to three bits and a hexadecimal digit maps to four. Grouping spaces do not enter the arithmetic; width-preserving mode pads each entered hexadecimal digit to its four-bit representation.

Frequently asked questions

What digits are valid in binary?
Binary uses only 0 and 1. This calculator ignores spaces and underscores so long bit strings can be grouped for reading, but any other character makes the entry invalid. It treats the input as an unsigned integer, not as text, bytes, or a signed machine word.
How does binary become decimal?
Each binary position is a power of two. Starting at the right, the places are 1, 2, 4, 8, 16, and so on. Multiply each place by its digit and add the products. Digits with zero contribute nothing, while digits with one include that place value.
Why does the result also show hex and octal?
Hexadecimal and octal are compact views of the same binary value. One hex digit represents four bits, and one octal digit represents three bits. Programmers use those bases because long binary strings become shorter while still preserving the underlying bit pattern.
Do leading zeros change the value?
Leading zeros do not change the numeric value. They often matter as formatting, such as showing an 8 bit byte or a 32 bit register, but the integer represented by 00001010 and 1010 is still ten unless another protocol assigns meaning to the width.
Can I use this for negative numbers?
The binary input mode accepts only unsigned binary digits, and the decimal mode accepts only nonnegative decimal digits. Negative computer integers need a width and an encoding such as two's complement, so a separate bit width specific tool is better for that job.
Does hexadecimal to binary preserve leading zeros?
Yes. The converter emits four binary bits per entered hexadecimal digit. For example, 000F becomes 0000 0000 0000 1111, preserving the entered 16-bit nibble width.

Related calculators

Binary Converter updated at