Number Base
Convert between Binary, Octal, Decimal, and Hexadecimal.
Input Configuration
Enter a number and select its current base.
Enter a number to convert.
Decimal Result:
—
About this topic
Binary (Base 2) The language of computers.
Uses only two digits: 0 and 1. Every value in a computer's memory is ultimately stored as a sequence of binary bits. It is the simplest positional numeral system.
Key formulas & rules
- •Uses digits 0 and 1
- •Each position represents a power of 2
- •Prefixed with 0b in code
- •A group of 8 bits is a byte
- •Computers use it due to transistor states (on/off)
- •Bitwise operations are performed in binary
Examples
| Input | Output | Note |
|---|---|---|
| 1010 | 10 | 8 + 0 + 2 + 0 |
| 1111 | 15 | 8 + 4 + 2 + 1 |
| 100000 | 32 | 2⁵ |
| 0b101 | 5 | Prefixed |
Real-world uses
Octal (Base 8) A compact shorthand for binary.
Uses digits 0 through 7. Before hexadecimal became dominant, octal was widely used in computing because it neatly groups binary bits into sets of three.
Key formulas & rules
- •Uses digits 0-7
- •Each position is a power of 8
- •Prefixed with 0o in code
- •One octal digit = 3 binary bits
- •Used in Unix file permissions
- •Less common in modern systems
Examples
| Input | Output | Note |
|---|---|---|
| 10 | 8 | 1 × 8 + 0 |
| 77 | 63 | 7 × 8 + 7 |
| 100 | 64 | 8² |
| 0o17 | 15 | Prefixed |
Real-world uses
Hexadecimal (Base 16) The standard for human-readable memory.
Uses digits 0-9 and letters A-F. It is the most popular base for representing computer memory because it groups binary into sets of four, making it much shorter than binary.
Key formulas & rules
- •Uses 0-9 and A-F
- •Each position is a power of 16
- •Prefixed with 0x in code
- •One hex digit = 4 binary bits
- •Used for memory addresses and color codes
- •Base of HTML/CSS colors
Examples
| Input | Output | Note |
|---|---|---|
| A | 10 | A represents 10 |
| FF | 255 | Max 8-bit value |
| 100 | 256 | 16² |
| 0x1A | 26 | Prefixed |
Real-world uses
Arbitrary Precision Handling numbers far larger than standard integers.
Standard JavaScript numbers lose precision above 2⁵³. This calculator uses BigInt to parse and convert numbers up to 200 digits, preventing overflow and precision loss.
Key formulas & rules
- •No floating-point rounding errors
- •Supports numbers up to 200 digits
- •Uses native BigInt parsing
- •Validates character sets strictly
- •Accepts prefixes (0x, 0b, 0o)
- •Rejects invalid digits for the base
Examples
| Input | Output | Note |
|---|---|---|
| 1000 digits | Supported | BigInt |
| 2⁶⁴ | Exact | Precision preserved |
| 0xFFFFFFFF | 4294967295 | 32-bit max |
| Invalid 2 | Error | 2 is not binary |
Real-world uses
Modes & formulas
Base Conversion
Conversion works by first parsing the input in base X to a decimal integer (using BigInt), then formatting that integer in base Y. Common prefixes (0x, 0b, 0o) and underscores are accepted.