Enter the number in the selected base
decimal = sum of (digit × base^position); target = decimal.toString(base)Every positional number system represents a value as a sum of digits multiplied by the base raised to a power. The converter parses the input into a base-10 integer using parseInt, then converts to the other bases using toString. The math works for any base from 2 to 36.
Enter any number and its base. See it in binary, octal, decimal, and hexadecimal at the same time.
Enter a number in binary, octal, decimal, or hexadecimal and see all four representations at once. Built for programmers, students learning number systems, and anyone reading hex color codes, binary file headers, or octal Unix permission strings.
Programmers read hex color codes. Network engineers stare at IP addresses in binary. System administrators set Unix file permissions in octal. Every digital system needs more than one number base, and converting between them by hand is error-prone. This converter handles all four common bases in a single step.
Definition
The computation, step by step
- 1Enter the number in the base you have.
- 2Pick that base from the From Base dropdown.
- 3The calculator converts to decimal first.
- 4It then converts decimal to binary, octal, and hexadecimal.
- 5All four representations are shown at once.
Solved example
A worked solution
Example: Convert decimal 255 to all bases
- 1Decimal 255 in binary: 255 = 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 11111111
- 2Decimal 255 in octal: 255 ÷ 64 = 3 remainder 63; 63 ÷ 8 = 7 remainder 7 → 377
- 3Decimal 255 in hex: 255 ÷ 16 = 15 remainder 15 → FF
Validity
Edge cases and pitfalls
- Forgetting the prefix when sharing a number: Writing "101" without context is ambiguous. Is it decimal one hundred and one, or binary five? Use prefixes (0b, 0o, 0x) or state the base.
- Mixing hex letters with words: In hex, "FACE" is a valid number (64,206). Beware of variable names that look like hex literals.
- Confusing octal with decimal: In many languages, a leading zero in a numeric literal triggers octal mode. "012" is 10, not 12.
- Off-by-one with bit positions: Bit 0 is the rightmost bit, with place value 1. Bit 7 in a byte has place value 128. Counting from the wrong side gives the wrong number.
Adjacent topics
Related concepts
| Term | Definition |
|---|---|
| Binary (base 2) | Two digits: 0 and 1. The native language of digital electronics. Prefixed 0b in most languages. |
| Octal (base 8) | Eight digits: 0 through 7. Used for Unix file permissions and a few legacy systems. Prefixed 0o. |
| Hexadecimal (base 16) | Sixteen digits: 0 through 9, then A through F. Used for memory addresses, color codes, and MAC addresses. Prefixed 0x. |
| Place value | In any base, each digit represents the base raised to its position. Hex "1A" means 1×16 + 10 = 26. |
Applications
Where this calculation appears
- Programming and debugging: Convert hex memory addresses to decimal when reading stack traces.
- Web development: Convert RGB color values between hex (#FF5733) and decimal (255, 87, 51).
- Networking: Convert IP address octets to binary for subnetting math.
- File permissions: Convert octal Unix permission codes (755, 644) to binary read-write-execute flags.
- Hardware and embedded: Read binary register values and convert to hex for documentation.
Implementation notes
Pro tips
- Memorize key powers of 2: Knowing 2¹⁰=1024, 2¹⁶=65,536, 2³²=4.3 billion lets you size data structures in your head.
- Use hex for grouped binary: Each hex digit equals exactly four binary bits. "0xFF" is "11111111", "0xA5" is "10100101". Much easier to read than long strings of 1s and 0s.
- Octal is dying except for Unix perms: Chmod codes are octal. Almost nothing else still uses octal. Recognize 644, 755, 777 by sight.
- Convert through decimal for safety: When converting between bases you do not use often, go through decimal first. It is one extra step but easier to verify.
Common questions
Frequently asked questions
Quick reference
Decimal 0 through 15 in All Bases
The full hexadecimal digit set
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 |
| 7 | 111 | 7 | 7 |
| 8 | 1000 | 10 | 8 |
| 10 | 1010 | 12 | A |
| 15 | 1111 | 17 | F |
| 16 | 10000 | 20 | 10 |
| 255typical | 11111111 | 377 | FF |
For related calculations, try the Data Storage Converter, GCD Calculator, or Exponent Calculator. Browse all Calculator Online calculators for the full catalog.
Methodology
This calculator uses the standard number base converter formula. Results match those from established financial, scientific, and health references.
Reviewed by
Calculator Online Editorial Team. All formulas verified against authoritative sources before publication.
Last updated
2026-05-24