Binary Converter

Convert between binary, octal, decimal, and hexadecimal. Bit visualization, powers of 2 reference, even/odd detection, and grouped binary output.

Binary (Base 2)
0010 1010
6 bits / 1 byte(s)
Octal (Base 8)
52
0o52
Decimal (Base 10)
42
42
Hexadecimal (Base 16)
2A
0x2A
Even/Odd
Even
LSB = 0
Power of 2?
No
Not a power of 2

Bit Visualization

0
2^7
0
2^6
1
2^5
0
2^4
1
2^3
0
2^2
1
2^1
0
2^0

All Bases Comparison

BasePrefixDigitsValue
Binary0b0-1101010
Octal0o0-752
Decimal0-942
Hexadecimal0x0-9, A-F2A
Planning notes, formulas, and examples

About the Binary Converter

Binary (base 2) is the fundamental language of computers, using only two digits — 0 and 1. Every piece of data stored or processed by a computer is ultimately represented in binary. Understanding binary conversion is essential for programmers, computer science students, network engineers, and anyone working with low-level computing concepts.

This converter handles all four major number bases: binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16). Enter a number in any base and see the equivalent in all others. The converter provides grouped binary output (4-bit groups for readability), bit count, byte count, and even detects whether the number is a power of 2.

The interactive bit visualization shows each bit position with its corresponding power of 2, making it easy to understand how positional notation works. Whether you are debugging bitwise operations, reading memory addresses, interpreting network masks, or studying for a CS exam, this converter keeps base conversion visual and easy to verify.

When This Page Helps

Manual base conversion is error-prone, especially for large numbers. This calculator converts between all four common bases, provides visual bit representation, groups binary for readability, and includes a powers-of-2 reference table — everything you need for computer science work in one place during study, debugging, exam prep, and review.

How to Use the Inputs

  1. Select the input number base from the dropdown (Binary, Octal, Decimal, or Hexadecimal).
  2. Enter the number in the input field. Spaces and underscores are ignored for readability.
  3. All other bases update in the output cards.
  4. Use the Bit Visualization to see which bits are set (for numbers up to 16 bits).
  5. Check the All Bases Comparison table for a side-by-side view.
  6. Expand the Powers of 2 Reference for common values in all bases.
Formula used
Decimal to Binary: Repeatedly divide by 2, read remainders bottom-up. Binary to Decimal: Sum of (bit × 2^position) for each bit. Binary to Hex: Group binary digits in fours, convert each group. Binary to Octal: Group binary digits in threes, convert each group.

Example Calculation

Result: 101010 (binary), 52 (octal), 2A (hex)

42 in decimal = 32 + 8 + 2 = 2⁵ + 2³ + 2¹ = 101010 in binary. Grouped as 0010 1010 = 0x2A in hex. In octal: 5×8 + 2 = 52.

Tips & Best Practices

  • Hex digits map directly to 4 binary bits: 0=0000, 1=0001... 9=1001, A=1010, B=1011, C=1100, D=1101, E=1110, F=1111.
  • Octal digits map to 3 binary bits: 0=000, 1=001, 2=010, 3=011, 4=100, 5=101, 6=110, 7=111.
  • Quick check: if a binary number ends in 0, the decimal value is even. If it ends in 1, it is odd.
  • A power of 2 in binary is always a single 1 followed by zeros: 2=10, 4=100, 8=1000, 16=10000.
  • Common programming prefixes: 0b (binary), 0o (octal), 0x (hex). No prefix = decimal.
  • An 8-bit byte can represent values 0-255 (0000 0000 to 1111 1111, or 0x00 to 0xFF).

Understanding Number Bases

A number base (or radix) determines how many unique digits are used. Binary uses 2 digits (0, 1), octal uses 8 (0-7), decimal uses 10 (0-9), and hexadecimal uses 16 (0-9, A-F). The value of each digit depends on its position: in decimal, 42 = 4×10¹ + 2×10⁰; in binary, 101010 = 1×2⁵ + 0×2⁴ + 1×2³ + 0×2² + 1×2¹ + 0×2⁰.

Binary in Programming

Programmers use binary for bitwise operations (AND, OR, XOR, NOT, shifts), bit flags, permissions, and low-level hardware control. Most programming languages support binary literals (0b1010), hex (0xFF), and sometimes octal (0o77). Understanding binary is essential for systems programming, embedded development, and network engineering.

Hexadecimal: The Programmer's Shorthand

Hexadecimal is popular because each hex digit represents exactly 4 bits (a nibble). This makes it compact while maintaining easy binary conversion. Color codes (#FF0000), memory addresses (0x7FFF0000), and MAC addresses (00:1A:2B:3C:4D:5E) all use hexadecimal.

Sources & Methodology

Last updated:

Frequently Asked Questions

  • Repeatedly divide by 2 and record the remainder. Read the remainders from bottom to top. Example: 13 ÷ 2 = 6 R 1, 6 ÷ 2 = 3 R 0, 3 ÷ 2 = 1 R 1, 1 ÷ 2 = 0 R 1 → 1101.