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:
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:
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:
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 0–9 plus A–F, where A through F represent 10 through 15. Repeated division by 16 produces the hexadecimal digits; reversing the direction expands those place values:
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:
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
| Decimal | Binary | Hexadecimal | Octal | Notes |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | Zero has one displayed digit here |
| 1 | 1 | 1 | 1 | Smallest nonzero bit |
| 2 | 10 | 2 | 2 | One two and no ones |
| 7 | 111 | 7 | 7 | Largest single octal digit |
| 8 | 1000 | 8 | 10 | First four-bit binary place |
| 15 | 1111 | F | 17 | Largest single hex digit |
| 16 | 10000 | 10 | 20 | First two-digit hex value |
| 45 | 101101 | 2D | 55 | Default example |
| 255 | 11111111 | FF | 377 | One byte when unsigned |
| 1024 | 10000000000 | 400 | 2000 | Two to the tenth power |
Common pitfalls
- Do not read a binary-looking string as decimal.
1000in 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
- NIST, FIPS 180-4: Secure Hash Standard — sections 3 and 5 use binary words and hexadecimal word notation.
- NIST CSRC, byte glossary entry — defines a byte as a sequence of eight bits.
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.