🔢 All Bases - Live Converter

Type in any field - all others update instantly.

Decimal Base 10
Binary Base 2
Hexadecimal Base 16
Octal Base 8

Quick Values

⚙️ Bitwise Operations

Enter two decimal numbers and select an operation.

A (Binary)-
B (Binary)-
AND Result-
Result (Binary)-
Result (Hex)-
Operation Reference
🔵
AND
1 only if both bits are 1.
Uses: masking, clearing bits
🟢
OR
1 if either bit is 1.
Uses: setting bits
🟡
XOR
1 if bits are different.
Uses: toggling, encryption
🔴
NOT
Flips all bits (0→1, 1→0).
Uses: complementing
⬅️
Left Shift (<<)
Shifts bits left, multiplies by 2.
Uses: fast multiplication
➡️
Right Shift (>>)
Shifts bits right, divides by 2.
Uses: fast division

🔤 Text ↔ ASCII Converter

📋 Decimal / Binary / Hex / Octal Reference

Common values across all 4 number systems.

DecimalBinaryHexOctalNotes

📐 How Number Systems Work

Positional Number Systems

Every number system uses positional notation - each digit's value depends on its position (place value).

Decimal (Base 10): digits 0–9
Binary (Base 2): digits 0–1
Octal (Base 8): digits 0–7
Hex (Base 16): digits 0–9, A–F

Value = Σ (digit × base^position)

Example: Decimal 255
= 2×10² + 5×10¹ + 5×10⁰
= 200 + 50 + 5 = 255

Decimal → Binary

Repeatedly divide by 2 and record remainders (read bottom to top).

Convert 13 to Binary:
13 ÷ 2 = 6 remainder 1 ↑
6 ÷ 2 = 3 remainder 0 ↑
3 ÷ 2 = 1 remainder 1 ↑
1 ÷ 2 = 0 remainder 1 ↑
Result: 1101 (read upward)

Binary → Decimal

Multiply each bit by its power of 2 and sum them.

Convert 1101 to Decimal:
1×2³ + 1×2² + 0×2¹ + 1×2⁰
= 8 + 4 + 0 + 1
= 13

Decimal → Hexadecimal

Divide by 16, record remainders using 0–9 and A–F.

Convert 255 to Hex:
255 ÷ 16 = 15 remainder 15 → F ↑
15 ÷ 16 = 0 remainder 15 → F ↑
Result: FF

Hex → Binary (Shortcut)

Each hex digit = exactly 4 binary bits. Convert each digit independently.

Convert 1A3F to Binary:
1 → 0001
A → 1010
3 → 0011
F → 1111
Result: 0001 1010 0011 1111

Why Programmers Love Hex

1 byte = 8 bits = exactly 2 hex digits
FF hex = 1111 1111 binary = 255 decimal

Colors in web: #FF5733
= R:FF(255) G:57(87) B:33(51)

Memory addresses: 0x7FFF0000
IPv6 addresses: 2001:0db8:85a3::8a2e

❓ Frequently Asked Questions

🤖
AI Insights - Coming Soon!
AI-powered explanations of binary and hex concepts, step-by-step conversion walkthroughs, and code examples.
Coming Soon - Stay Tuned!

Binary & Hex Converter - Number Systems Explained for Developers and Students

Binary, hexadecimal, octal, and decimal are all just different ways to represent the same underlying numbers. Decimal is what we use every day. Binary is what computers actually work with at the hardware level. Hexadecimal is the shorthand that programmers use because it maps perfectly onto binary. And octal shows up in Unix file permissions and legacy systems. This converter handles all four instantly - type in any one and the others update in real time.

Quick reference: The decimal number 255 is 11111111 in binary, FF in hexadecimal, and 377 in octal. It's also the maximum value a single byte can hold - 8 bits all set to 1. This is why 255 appears constantly in computing: max RGB color values, IP address octets, and 8-bit unsigned integers all max out at 255.

How to Convert Binary to Decimal (Step by Step)

Binary is base 2, which means each digit position represents a power of 2 - starting from 2⁰ = 1 on the right and doubling with each position to the left. To convert binary to decimal, multiply each bit by its positional power of 2 and add the results.

Example: convert 1101 to decimal:

  • Position 3 (leftmost): 1 × 2³ = 1 × 8 = 8
  • Position 2: 1 × 2² = 1 × 4 = 4
  • Position 1: 0 × 2¹ = 0 × 2 = 0
  • Position 0 (rightmost): 1 × 2⁰ = 1 × 1 = 1
  • Total: 8 + 4 + 0 + 1 = 13

How to Convert Decimal to Binary (Step by Step)

Divide the decimal number by 2 repeatedly, recording the remainder each time. When the quotient reaches 0, stop. Read the remainders from bottom to top - that's the binary result.

Example: convert 13 to binary:

  • 13 ÷ 2 = 6, remainder 1
  • 6 ÷ 2 = 3, remainder 0
  • 3 ÷ 2 = 1, remainder 1
  • 1 ÷ 2 = 0, remainder 1
  • Reading upward: 1101

Why Programmers Use Hexadecimal

Hex is not just an alternative to decimal - it's a compact notation for binary. One hex digit represents exactly 4 binary bits (a "nibble"). Two hex digits represent exactly 8 bits (one byte). This 1:4 and 2:8 relationship makes hex invaluable for working with raw binary data.

Where You See Hex Every Day

  • Web colors - #FF5733 = R:255, G:87, B:51
  • Memory addresses - 0x7FFF0000
  • IPv6 addresses - 2001:0db8:85a3::8a2e
  • MAC addresses - 00:1A:2B:3C:4D:5E
  • SHA hashes - long hex strings
  • Unix permissions - chmod 0755

Hex Digit to Binary Lookup

  • 0 → 0000    8 → 1000
  • 1 → 0001    9 → 1001
  • 2 → 0010    A → 1010
  • 3 → 0011    B → 1011
  • 4 → 0100    C → 1100
  • 5 → 0101    D → 1101
  • 6 → 0110    E → 1110
  • 7 → 0111    F → 1111

Bitwise Operations - What They Do and Why They Matter

Bitwise operations work directly on the individual bits of a number, one pair of bits at a time. They run at the hardware level and are dramatically faster than arithmetic operations, making them essential in performance-critical code, cryptography, graphics, and networking.

  • AND (&) - Returns 1 only if both bits are 1. Used for masking: extract specific bits from a value. Example: 60 AND 13 = 12 (in binary: 0011 1100 AND 0000 1101 = 0000 1100).
  • OR (|) - Returns 1 if either bit is 1. Used to set specific bits. Example: 60 OR 13 = 61.
  • XOR (^) - Returns 1 if bits are different, 0 if they're the same. Used in encryption, checksums, and toggling bits. A number XORed with itself is always 0. A number XORed with 0 is itself.
  • NOT (~) - Flips all bits. In 32-bit integers, NOT 60 = -61 due to two's complement representation.
  • Left Shift (<<) - Shifts all bits left by n positions, effectively multiplying by 2ⁿ. Much faster than multiplication for powers of 2.
  • Right Shift (>>) - Shifts bits right, dividing by 2ⁿ. Used for fast integer division by powers of 2.

ASCII - How Text Becomes Numbers

Every character you type - letters, digits, punctuation - is stored as a number in your computer's memory. ASCII (American Standard Code for Information Interchange) is the original mapping that assigned numbers 0–127 to the basic Latin characters used in English. "A" = 65, "a" = 97, "0" = 48, space = 32.

When you type the word "Hello" in a text file, the computer stores it as 5 bytes: 72, 101, 108, 108, 111 - or in hex: 48, 65, 6C, 6C, 6F. The ASCII converter tab lets you see this mapping for any text you type, showing the decimal code, hex code, and 8-bit binary representation for each character.

Modern text mostly uses UTF-8, which is a superset of ASCII - the first 128 characters of UTF-8 are identical to ASCII, so all basic English text converts exactly the same way.

Key Values to Know in Computing

Certain numbers appear constantly in computing because of how binary works. Knowing them by heart makes you faster at debugging and more fluent in technical conversations:

  • 255 (0xFF) - Maximum value of a byte (8 bits all set to 1)
  • 256 (0x100) - First value that doesn't fit in a byte; also the number of possible byte values
  • 1024 - 2¹⁰, the base of kilobyte (1 KB = 1,024 bytes)
  • 65,535 (0xFFFF) - Maximum value of a 16-bit unsigned integer
  • 65,536 (0x10000) - 2¹⁶, first value exceeding 16 bits
  • 127 (0x7F) - Maximum value of a signed 8-bit integer
  • 128 (0x80) - The "sign bit" in signed 8-bit representation (indicates negative in two's complement)