Home › Math Calculators › Number Base Converter

Number Base Converter

Convert numbers between Binary, Octal, Decimal, Hexadecimal, and any custom base (2–36) — instantly, with full step-by-step breakdown and bit representation.

🔢 Number Base Converter

Letters A–F (or a–f) for bases above 10. Spaces and underscores ignored.
🧮 Step-by-Step Conversion Breakdown
🔵 Binary (Base 2) Bit Representation
Advertisement
240 × 600
Ad Space
Paste your ad network tag here
✓ Copied to clipboard

What Is a Number Base? A Complete Guide

A number base (also called a radix) is the number of unique digits — including zero — that a positional numeral system uses to represent numbers. In everyday life, we use base 10 (decimal), but computers, networking, programming, and mathematics regularly use other bases — especially base 2 (binary), base 8 (octal), and base 16 (hexadecimal).

Every positional number system works on the same principle: the value of each digit depends not only on what the digit is, but also on its position. Each position represents a power of the base. Moving one position to the left multiplies the value by the base.

Key Concept: In any base-n system, a number like d₃d₂d₁d₀ has the value:
d₃ × n³ + d₂ × n² + d₁ × n¹ + d₀ × n⁰
BIN
Base 2 (Binary)
OCT
Base 8 (Octal)
DEC
Base 10 (Decimal)
HEX
Base 16 (Hexadecimal)

Why Do Different Bases Exist?

Different number bases serve different purposes. Humans evolved counting with base 10, likely because we have 10 fingers. Computers, however, are built from electronic switches that are either ON or OFF — a perfect fit for base 2 (binary). Other bases like octal (base 8) and hexadecimal (base 16) exist because they are mathematically convenient shorthand for binary, allowing humans to work with binary data more easily.

  • Base 2 (Binary): The language of computers and digital electronics. Every piece of data, every instruction, every image stored on a computer is ultimately represented in binary.
  • Base 8 (Octal): Used in older computing systems (Unix file permissions), and as a compact representation of binary groups of 3 bits.
  • Base 10 (Decimal): The standard human counting system. Used in everyday mathematics, commerce, and general-purpose calculations.
  • Base 16 (Hexadecimal): Extremely common in computing — used for memory addresses, colour codes, IP addresses, machine code, and debugging output.
  • Base 32 / Base 64: Used in encoding schemes for data transmission and storage, including URL encoding and email attachments.
  • Base 36: Uses digits 0–9 and letters A–Z, commonly used in URL shorteners and unique ID systems.

Binary (Base 2) — The Language of Computers

Binary is a base-2 number system that uses only two digits: 0 and 1. Each digit in a binary number is called a bit (binary digit). A group of 8 bits is called a byte, and a byte can represent values from 0 to 255.

Binary is the fundamental language of all digital computers. Every character you type, every pixel on your screen, every instruction your CPU executes is ultimately stored and processed as a sequence of 0s and 1s. The reason is purely physical: electronic circuits have two stable states — current flowing (1) or not flowing (0).

Binary Place Values

Position: 7 6 5 4 3 2 1 0 Power: 2⁷ 2⁶ 2⁵ 2⁴ 2³ 2² 2¹ 2⁰ Value: 128 64 32 16 8 4 2 1
✔ Example — Converting binary 11010110 to decimal

1×128 + 1×64 + 0×32 + 1×16 + 0×8 + 1×4 + 1×2 + 0×1

= 128 + 64 + 0 + 16 + 0 + 4 + 2 + 0

= 214 (decimal)

Binary in Computing

  • 1 bit = one binary digit (0 or 1)
  • 1 nibble = 4 bits = values 0–15 (one hex digit)
  • 1 byte = 8 bits = values 0–255
  • 1 kilobyte (KB) = 1,024 bytes = 8,192 bits
  • 1 megabyte (MB) = 1,048,576 bytes
  • 32-bit integer = values −2,147,483,648 to 2,147,483,647
  • 64-bit integer = values up to ±9.2 × 10¹⁸
Memory Tip: Binary numbers are easy to recognise — they only contain 0s and 1s. The number 1011 is a valid binary number; 1021 is not (the digit 2 doesn't exist in base 2).

Binary Arithmetic

Binary arithmetic follows the same rules as decimal, but with only two digits. When you add 1 + 1 in binary, you get 10 (which is 2 in decimal — carry the 1).

OperationBinaryDecimal Equivalent
Addition1010 + 0110 = 1000010 + 6 = 16
Subtraction1100 − 0011 = 100112 − 3 = 9
AND1010 AND 1100 = 1000Bitwise AND
OR1010 OR 1100 = 1110Bitwise OR
XOR1010 XOR 1100 = 0110Bitwise XOR
Left shift0001 << 3 = 10001 × 2³ = 8
Right shift1000 >> 2 = 00108 ÷ 4 = 2

Hexadecimal (Base 16) — The Programmer's Shorthand

Hexadecimal (hex) is a base-16 number system that uses 16 distinct symbols: the digits 0–9 and the letters A–F (where A=10, B=11, C=12, D=13, E=14, F=15). Hexadecimal is enormously popular in programming because one hex digit represents exactly 4 binary bits (a nibble), making it a compact and readable way to express binary data.

Hex Digit to Binary Mapping

HexDecimalBinary (4-bit)HexDecimalBinary (4-bit)
000000881000
110001991001
220010A101010
330011B111011
440100C121100
550101D131101
660110E141110
770111F151111

Where Is Hexadecimal Used?

  • Colour codes in web design: #FF5733 — each pair of hex digits represents red, green, and blue (0–255 each)
  • Memory addresses: 0x7FFF0000 — RAM and virtual memory addresses in debuggers and system logs
  • Machine code and bytecode: Assembly instructions are displayed in hex in disassemblers
  • MAC addresses in networking: A4:C3:F0:85:AC:2D
  • UUID / GUID identifiers: 550e8400-e29b-41d4-a716-446655440000
  • Cryptographic hashes: SHA-256 outputs 64 hex characters (256 bits)
  • IPv6 addresses: Written entirely in hexadecimal with colons
✔ Example — Web colour #3A8EF0 in binary

3 = 0011   A = 1010   8 = 1000   E = 1110   F = 1111   0 = 0000

#3A8EF0 = 0011 1010 1000 1110 1111 0000

R = 3A = 58  |  G = 8E = 142  |  B = F0 = 240

Octal (Base 8) — The Unix System Standard

Octal is a base-8 number system using digits 0–7. Each octal digit represents exactly 3 binary bits, making octal a convenient way to group binary data in sets of three. While octal has been largely replaced by hexadecimal in modern computing, it remains important in specific areas.

Key Uses of Octal

  • Unix/Linux file permissions: The chmod 755 command uses octal — 7 (rwx), 5 (r-x), 5 (r-x). Each digit maps to three permission bits.
  • Legacy computing systems: Older mainframes and minicomputers (PDP-8, etc.) used octal extensively.
  • C programming: Octal literals are written with a leading zero — 0755 in C is octal 755, not decimal 755.
  • Network addressing: Some network configuration tools use octal for certain parameters.
✔ Example — Unix permission chmod 755

Octal 7 = binary 111 = rwx (read, write, execute) — owner

Octal 5 = binary 101 = r-x (read, execute only) — group

Octal 5 = binary 101 = r-x (read, execute only) — others

chmod 755 = rwxr-xr-x

Binary ↔ Octal Conversion

To convert binary to octal, group the binary digits in sets of 3 (from right to left) and convert each group to its octal equivalent:

Binary: 110 111 010 ↓ ↓ ↓ Octal: 6 7 2 → 672

How to Convert Between Number Bases — Step-by-Step Methods

Understanding manual conversion methods is essential for programming interviews, computer science exams, and developing an intuition for how numbers work at the hardware level. Here are the standard methods for all common conversions.

Method 1 — Decimal to Any Base (Repeated Division)

Divide the decimal number by the target base repeatedly, recording the remainder each time. When the quotient reaches 0, read the remainders from bottom to top.

✔ Example — Convert 156 (decimal) to Binary (base 2)
DivisionQuotientRemainder (LSB first)
156 ÷ 2780
78 ÷ 2390
39 ÷ 2191
19 ÷ 291
9 ÷ 241
4 ÷ 220
2 ÷ 210
1 ÷ 201 ← MSB

Result (read remainders upward): 10011100₂

Verify: 128+0+0+16+8+4+0+0 = 156 ✓

Method 2 — Any Base to Decimal (Positional Expansion)

Multiply each digit by its base raised to its positional power, then sum all the results.

✔ Example — Convert 2F8 (Hex) to Decimal

2 × 16² + F × 16¹ + 8 × 16⁰

= 2 × 256 + 15 × 16 + 8 × 1

= 512 + 240 + 8

= 760 (decimal)

Method 3 — Binary to Hex (Group by 4)

Group binary digits into sets of 4 from the right, padding with leading zeros if needed. Convert each 4-bit group directly to one hex digit.

✔ Example — Binary 10110111 to Hex

Group: 1011 | 0111

1011 = B  |  0111 = 7

Result: B7 (hex)

Method 4 — Binary to Octal (Group by 3)

✔ Example — Binary 10110111 to Octal

Group from right: 010 | 110 | 111

010 = 2  |  110 = 6  |  111 = 7

Result: 267 (octal)

Complete Conversion Reference Table

DecimalBinaryOctalHexBase 32
00000000
10001111
40100444
810001088
10101012AA
15111117FF
16100002010G
32100000402010
6410000001004020
10011001001446434
128100000002008040
25511111111377FF7V
25610000000040010080
1000111110100017503E8V8
655351111111111111111177777FFFF1VVV

Real-World Applications of Number Base Conversion

Number base conversion is not just an academic exercise — it is a practical skill used daily by software engineers, network administrators, security researchers, and hardware designers.

1. Web Design — HTML Colour Codes

Every colour in CSS and HTML is expressed as a hexadecimal triplet. The colour #1A6FC4 (the blue used on EazyCalc) represents Red=1A (26), Green=6F (111), Blue=C4 (196). Understanding hex-to-decimal conversion allows designers to programmatically manipulate colours, build colour pickers, and convert between RGB and hex formats.

2. Computer Memory and Addressing

RAM addresses are universally displayed in hexadecimal in debuggers, crash dumps, and operating system tools. A 64-bit system uses addresses like 0x00007FFF5FBFF8D0 — 16 hex digits representing 64 bits. Converting these to binary or decimal helps developers understand memory layouts and identify buffer overflow vulnerabilities.

3. Network Engineering — IP Addresses

IPv4 addresses are fundamentally 32-bit binary numbers. The IP address 192.168.1.1 in binary is 11000000.10101000.00000001.00000001. Subnet mask calculations, wildcard masks, and access control lists all rely on binary operations applied to IP addresses. IPv6 addresses are written directly in hexadecimal.

4. Cryptography and Security

Cryptographic operations — hashing, encryption, digital signatures — all operate on binary data. SHA-256 produces a 256-bit (32-byte) output displayed as 64 hexadecimal characters. AES encryption keys are 128, 192, or 256 bits, typically entered as hex strings. Security professionals regularly convert between hex, binary, and decimal when analysing malware, reverse engineering binaries, or testing cryptographic implementations.

5. Embedded Systems and Microcontrollers

Programming microcontrollers (Arduino, STM32, Raspberry Pi) requires setting hardware registers directly using binary or hex values. A register controlling pin output on an ATmega328 might be set with PORTB = 0b00100000 (binary) or PORTB = 0x20 (hex) — both setting pin 5 high. Understanding base conversion is fundamental to embedded programming.

6. Data Encoding — Base64 and URL Encoding

Base64 encoding (base 36 extended with + and /) is used to transmit binary data as text — in email attachments (MIME), JWT tokens, and data URIs for embedding images in HTML. Base32 is used in two-factor authentication (TOTP) secret keys. URL percent-encoding uses hex: a space is %20, because 20 in hex = 32 in decimal = ASCII space character.

7. Programming and Debugging

Most programming languages support numeric literals in multiple bases:

LanguageBinaryOctalHexadecimal
Python0b10100o120x0A
JavaScript0b10100o120x0A
C / C++0b10100120x0A
Java0b10100120x0A
Rust0b10100o120x0A
CSSN/AN/A#0A0A0A
Assembly1010b12o0Ah or 0x0A

8. File Formats and Binary Analysis

Every file format has a binary signature (magic bytes) at the start. JPEG files begin with FF D8 FF, PNG files with 89 50 4E 47, PDF files with 25 50 44 46 (%PDF in ASCII). Hex editors display file contents in hexadecimal, and forensic analysts use base conversions constantly when examining file headers, network packets, and encrypted data.

Advanced Topics — Signed Numbers, Two's Complement, and Floating Point

Signed Binary Numbers — Two's Complement

Standard binary represents non-negative integers. To represent negative numbers in binary, modern computers use two's complement. In two's complement, the most significant bit (MSB) is the sign bit — 0 for positive, 1 for negative.

To find the two's complement of a number: invert all bits (one's complement), then add 1.

✔ Example — Representing −43 in 8-bit two's complement

43 in binary: 00101011

Invert all bits: 11010100

Add 1: 11010101

−43 in 8-bit two's complement = 11010101₂ = D5₁₆

Two's complement is used universally in CPUs because it allows the same hardware circuits to perform both addition and subtraction — adding a negative number gives the same result as subtracting its positive equivalent.

Floating Point Binary (IEEE 754)

Decimal fractions (like 3.14) in binary use a format analogous to scientific notation. IEEE 754 is the international standard for floating-point arithmetic used by virtually all modern processors. A 32-bit float consists of:

  • 1 sign bit — positive (0) or negative (1)
  • 8 exponent bits — stored with a bias of 127
  • 23 mantissa (significand) bits — the fractional precision
Important: Not all decimal fractions can be represented exactly in binary floating point. The number 0.1 in decimal has no exact binary representation — it repeats infinitely, similar to 1/3 in decimal. This is why 0.1 + 0.2 ≠ 0.3 in most programming languages and why financial software uses integer arithmetic in the lowest denomination rather than floating point.

Number Base Systems Summary

BaseNameDigits UsedPrefixPrimary Use
2Binary0, 10bDigital circuits, CPUs, memory
8Octal0–70oUnix permissions, legacy systems
10Decimal0–9(none)Human counting, everyday maths
16Hexadecimal0–9, A–F0xMemory, colours, networking, crypto
32Base-320–9, A–V(varies)TOTP secrets, encoding
36Base-360–9, A–Z(varies)URL shorteners, unique IDs
64Base-64A–Z,a–z,0–9,+,/(varies)Email encoding, JWT, data URIs

Frequently Asked Questions — Number Base Converter

Answers to the most searched questions about binary, hexadecimal, octal, decimal, and number base conversion.

Multiply each binary digit by 2 raised to its position power (rightmost position = 0), then add all results. Example: 1101₂ = 1×2³ + 1×2² + 0×2¹ + 1×2⁰ = 8+4+0+1 = 13. Our calculator shows this step-by-step breakdown automatically for any number you enter.
Repeatedly divide the decimal number by 2, recording remainders each time. Read the remainders from bottom to top. Example: 13 → 13÷2=6 R1, 6÷2=3 R0, 3÷2=1 R1, 1÷2=0 R1 → read upward: 1101₂. This method works for any base — just replace 2 with your target base.
Hexadecimal (base 16) uses digits 0–9 and letters A–F. Each hex digit represents exactly 4 binary bits, making it a compact shorthand for binary. The byte 11111111₂ becomes just FF₁₆. Hex is used for memory addresses, HTML/CSS colours (#FF5733), MAC addresses, cryptographic hashes (SHA-256 outputs 64 hex chars), IPv6 addresses, and machine code in debuggers.
Multiply each hex digit by 16 to the power of its position and sum the results. Remember A=10, B=11, C=12, D=13, E=14, F=15. Example: 2F₁₆ = 2×16 + 15×1 = 32+15 = 47. For 1A3₁₆: 1×256 + 10×16 + 3×1 = 256+160+3 = 419.
They are four different ways to express the same number: Binary (base 2) uses 0 and 1 only — used by computers internally. Octal (base 8) uses 0–7 — used in Unix file permissions. Decimal (base 10) uses 0–9 — everyday human counting. Hex (base 16) uses 0–9 and A–F — used by programmers. The number 255 = 11111111₂ = 377₈ = FF₁₆.
Group binary digits into sets of 4 from the right (add leading zeros to the leftmost group if needed). Convert each 4-bit group to one hex digit. Example: 10110111₂ → 1011|0111 → B|7 → B7₁₆. This is why hex is so popular — each byte (8 bits) becomes exactly 2 hex digits, making memory displays much easier to read.
Two's complement represents negative integers in binary. Steps: (1) write the positive number in binary, (2) invert all bits, (3) add 1. Example: −5 in 8-bit → 5 = 00000101 → invert = 11111010 → add 1 = 11111011. Two's complement lets CPUs subtract using only addition circuits, and the MSB (leftmost bit) acts as the sign bit: 0=positive, 1=negative.
The 0x prefix indicates a hexadecimal number in C, C++, Java, Python, JavaScript, and most other languages. So 0xFF = 255 in decimal. Similarly: 0b prefix = binary (0b1010 = 10), 0o prefix = octal in Python/JS (0o17 = 15), and a leading 0 (in C/Java) = octal (017 = 15). Always check which prefix convention your language uses.
Multiply each octal digit by 8 raised to its positional power, then sum all results. Example: 157₈ = 1×64 + 5×8 + 7×1 = 64+40+7 = 111 in decimal. For Unix permission chmod 755: 7×64 + 5×8 + 5×1 = 448+40+5 = 493 — but more usefully, each digit maps to 3 permission bits: 7=111=rwx, 5=101=r-x.
Electronic transistors have two stable physical states: conducting (1) or non-conducting (0). Building circuits that reliably distinguish just 2 states is far simpler and more robust than distinguishing 10 voltage levels for decimal. Binary transistors switch billions of times per second, can be shrunk to a few nanometres, and produce consistent results under varying temperatures and voltages. Every CPU, RAM chip, SSD, and digital communication system is built on this binary foundation.