Convert Number Bases

Enter a number and select the bases to convert between:

Common Conversions:
Binary (2): 0,1 โ€ข Octal (8): 0-7 โ€ข Decimal (10): 0-9 โ€ข Hex (16): 0-9,A-F

Understanding Number Systems

Number systems are fundamental to computer science and mathematics. Different bases are used for different purposes, from binary in computers to hexadecimal for memory addresses.

Common Number Systems

๐Ÿ”ข Decimal (Base 10)

Digits: 0-9
Most familiar system
Used for everyday counting
10 distinct digits
Positional notation with powers of 10

๐Ÿ’ป Binary (Base 2)

Digits: 0,1
Foundation of computing
Represents on/off states
Used by all digital computers
Each digit is a bit (binary digit)

๐Ÿ”ง Octal (Base 8)

Digits: 0-7
Used in early computers
Convenient for byte representation
3 bits = 1 octal digit
Common in Unix file permissions

๐ŸŽจ Hexadecimal (Base 16)

Digits: 0-9,A-F
Compact binary representation
4 bits = 1 hex digit
Used for memory addresses
Common in HTML color codes

Positional Notation

Base Example Calculation Decimal Value
Binary (2) 1010โ‚‚ (1ร—2ยณ) + (0ร—2ยฒ) + (1ร—2ยน) + (0ร—2โฐ) 8 + 0 + 2 + 0 = 10
Octal (8) 52โ‚ˆ (5ร—8ยน) + (2ร—8โฐ) 40 + 2 = 42
Decimal (10) 42โ‚โ‚€ (4ร—10ยน) + (2ร—10โฐ) 40 + 2 = 42
Hexadecimal (16) 2Aโ‚โ‚† (2ร—16ยน) + (10ร—16โฐ) 32 + 10 = 42

Famous Numbers in Different Bases

Number Binary Octal Decimal Hexadecimal Description
42 101010 52 42 2A Answer to Life, Universe, Everything
255 11111111 377 255 FF Maximum 8-bit unsigned value
256 100000000 400 256 100 2โธ (one byte + 1)
1024 10000000000 2000 1024 400 2ยนโฐ (one kilobyte in binary)
4096 1000000000000 10000 4096 1000 4K memory page

Computer Science Applications

๐Ÿง  Memory Addressing

Hexadecimal for memory locations
Binary for bit manipulation
Understanding pointer arithmetic
Memory allocation concepts
Computer architecture fundamentals

๐ŸŽจ Digital Colors

RGB values in hexadecimal
HTML color codes (#RRGGBB)
Image pixel representation
Color depth calculations
Graphics file formats

๐Ÿ” Cryptography

Binary operations in encryption
Hex representation of keys
Hash function outputs
Digital signature algorithms
Secure random generation

Programming Language Examples

๐Ÿ’ป C/C++

0b prefix for binary literals
0x prefix for hexadecimal
printf format specifiers
Bit manipulation operators
Memory address printing

๐Ÿ Python

0b prefix for binary
0o prefix for octal
0x prefix for hexadecimal
bin(), oct(), hex() functions
format() method with bases

โ˜• JavaScript

0b for binary literals
0o for octal literals
0x for hexadecimal
parseInt() with radix
toString() with base parameter

Historical Number Systems

๐Ÿ—‚๏ธ Babylonian (Base 60)

Used for time and angles
Still used in modern timekeeping
60 seconds = 1 minute
60 minutes = 1 degree
Ancient mathematical system

๐Ÿ“ Mayan (Base 20)

Vigesimal counting system
Used positional notation
Complex calendar systems
Influenced by finger counting
Advanced mathematical concepts

๐Ÿ›๏ธ Roman Numerals

Additive and subtractive notation
Not truly positional
Limited to certain values
Still used in some contexts
Symbolic rather than mathematical

Binary Operations

โž• Binary Addition

0 + 0 = 0
0 + 1 = 1
1 + 0 = 1
1 + 1 = 10 (carry 1)
Fundamental to computer arithmetic

โœ–๏ธ Binary Multiplication

0 ร— 0 = 0
0 ร— 1 = 0
1 ร— 0 = 0
1 ร— 1 = 1
Used in digital multiplication circuits

๐Ÿ”€ Bitwise Operations

AND (&): 1 & 1 = 1, otherwise 0
OR (|): 0 | 0 = 0, otherwise 1
XOR (^): 1 ^ 1 = 0, 0 ^ 0 = 0, otherwise 1
Essential for computer logic

๐Ÿ’ป Programming Tip: Remember that computers use binary internally, but hexadecimal provides a compact way to represent binary data. Each hex digit represents exactly 4 bits, making conversions simple: 1010โ‚‚ = Aโ‚โ‚†.