🔢 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 (01, 10).
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

Multiply each binary digit by its positional power of 2 (starting from 2⁰ = 1 on the right) and add the results. Example: 1101 in binary = 1×8 + 1×4 + 0×2 + 1×1 = 13 in decimal. The key insight: the rightmost bit is worth 1, the next is worth 2, then 4, 8, 16, 32, 64, 128 - each position doubles the value of the one to its right.
Repeatedly divide the decimal number by 2 and record each remainder. When the quotient reaches 0, stop. Read the remainders from bottom to top for the binary result. Example: 13 → divide by 2: get 6r1, 3r0, 1r1, 0r1 → reading up: 1101. The converter above does this instantly - just type the decimal number in the Decimal field.
Hexadecimal (hex) is base 16, using digits 0–9 and A–F (where A=10, B=11, C=12, D=13, E=14, F=15). Programmers use it because one hex digit maps exactly to 4 binary bits, making it a compact notation for binary. A byte (8 bits) is always exactly 2 hex digits. So instead of writing 11111111 in binary, you write FF in hex - much shorter and just as precise. This is why hex appears in color codes, memory addresses, and encryption hashes.
Electronic circuits naturally operate in two stable states: high voltage and low voltage - represented as 1 and 0. Building circuits that reliably distinguish 10 different voltage levels (for decimal) would be vastly more complex, expensive, and error-prone than circuits that just distinguish two states. Binary maps perfectly to physical transistor states: on or off. Everything a computer processes - text, images, video, software - is ultimately stored and manipulated as sequences of 1s and 0s.
A byte is 8 bits. It can represent 256 different values, from 0 (00000000 in binary) to 255 (11111111). A byte is the fundamental unit of digital storage and information. All file sizes, memory amounts, and network speeds are measured in multiples of bytes: kilobytes (KB = 1,024 bytes), megabytes (MB = 1,048,576 bytes), gigabytes (GB = ~1 billion bytes). A single ASCII character takes 1 byte. A typical high-resolution photo takes several megabytes.
Bitwise operations manipulate individual bits directly and are used extensively in: (1) Cryptography and hashing - XOR is a fundamental building block of most encryption algorithms. (2) Graphics - pixel color manipulation using AND/OR for masking. (3) Network programming - extracting IP addresses and port numbers from packed integers. (4) Performance optimization - shifting bits is faster than multiplication/division by powers of 2. (5) Flags and permissions - Unix file permissions (chmod 755) use octal representations of permission bit patterns. (6) Embedded systems - controlling hardware registers by setting and clearing specific bits.
The '0x' prefix is a universally recognized programming convention to indicate that the number is written in hexadecimal. For example, 0xFF = 255 in decimal. 0x1A = 26. 0x7FFF = 32,767. This convention is used in C, C++, Java, Python, JavaScript, and virtually every other programming language. You'll also see it in memory dumps, debugger output, assembly language, and hardware documentation. The 'x' stands for hex (hexadecimal starts with 'x' in the word).
ASCII (American Standard Code for Information Interchange) is a standard that assigns a unique number to each character in the English alphabet, digits, and punctuation marks. 'A' = 65, 'a' = 97, '0' = 48, space = 32. These decimal numbers are then stored in binary - 'A' (65) becomes 01000001 in binary and 41 in hex. When you type a document, your computer stores sequences of these binary numbers. Modern text uses UTF-8, which extends ASCII for international characters, but the first 128 characters are identical to original ASCII.

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)

How this calculator works, and where the numbers come from

The Binary / Hex Converter applies the standard formula for this calculation to the values you enter and updates the result as you type. The calculation itself happens in your browser, and the page explains the method so you can check any result by hand.

Please note: Results are provided for general information and are calculated from the values you enter.

Sources and further reading

Last reviewed: by the CalcQube Editorial Team. See our editorial policy for how we build and check calculators, or report an error.