How to use Binary ↔ Decimal
- 1
Select the input format (Binary, Decimal, Octal, or Hexadecimal).
- 2
Type your number in the input field.
- 3
See all four conversions displayed instantly.
Convert numbers between Binary, Decimal, Octal, and Hexadecimal instantly. All four results shown simultaneously with copy buttons.
Select the input format (Binary, Decimal, Octal, or Hexadecimal).
Type your number in the input field.
See all four conversions displayed instantly.
JavaScript can safely handle integers up to 2^53 - 1. For most computing and programming purposes, this is more than sufficient.
Octal (base 8) is used in Unix/Linux file permissions. For example, chmod 755 uses octal notation.
Every number you write down is expressed in a base — a positional system that defines how many symbols are available and how place value works. Humans default to base 10 (decimal) because we have 10 fingers. Computers use base 2 (binary) at the hardware level because transistors have two states: on or off. Programmers frequently work in base 16 (hexadecimal) because it maps neatly to binary bytes.
This converter lets you type a number in any of the four main systems and see its equivalent in all others simultaneously — no switching tabs, no manual arithmetic.
Decimal (Base 10) — The everyday system. Digits: 0–9. Positional value: each place is 10× the one to its right. The number 255 means (2 × 100) + (5 × 10) + (5 × 1).
Binary (Base 2) — The hardware language. Digits: 0 and 1 only. Each place is 2× the previous. The number 11111111 in binary = 255 in decimal. Every file, pixel, and byte your computer processes is ultimately stored this way.
Octal (Base 8) — Digits 0–7. Primarily seen in Unix/Linux file permissions. When a developer types chmod 755, those three digits are octal — each representing three bits of the binary permission string. 7 = 111 binary = read+write+execute.
Hexadecimal (Base 16) — Digits 0–9, then A–F. A = 10, B = 11, ... F = 15. Each hex digit represents exactly 4 binary bits, making it a compact and human-readable way to express binary data. Two hex digits = one byte. Used everywhere: memory addresses, colour codes, cryptographic hashes.
Every conversion routes through decimal as an intermediate:
Any base → Decimal: Multiply each digit by its positional value and sum.
Binary 1011 = (1 × 8) + (0 × 4) + (1 × 2) + (1 × 1) = 11
Hex B = 11
Octal 13 = (1 × 8) + (3 × 1) = 11
Decimal → Any base: Repeatedly divide by the target base and collect remainders.
11 ÷ 2 = 5 R1
5 ÷ 2 = 2 R1
2 ÷ 2 = 1 R0
1 ÷ 2 = 0 R1 → Read remainders bottom-to-top: 1011
Binary: You won't often type raw binary — it's what CPUs work with internally. But you'll encounter it when reading about bit flags, network masks (a /24 subnet mask is 11111111.11111111.11111111.00000000), or working with embedded systems.
Octal: Mainly Unix file permissions. When you see drwxr-xr-x, that's 755 in octal: owner has 7 (read+write+execute), group has 5 (read+execute), others have 5. Terminal users run chmod 644 or chmod 777 without necessarily thinking "that's base 8."
Hexadecimal: This one shows up constantly:
#FF5733 is 3 bytes — Red=FF (255), Green=57 (87), Blue=33 (51)0x7fff5fbff8b8 — the 0x prefix signals hex550e8400-e29b-41d4-a716-446655440000 uses hex digits throughoutA is decimal 65, hex 41Computer science coursework: Number base conversion is a standard CS101 topic. Students working through manual conversion exercises can verify their work instantly.
CSS colour manipulation: Need to know what #3B82F6 looks like in decimal R/G/B? The hex-to-decimal conversion gives you 59 / 130 / 246 — directly usable in CSS rgb() syntax.
Working with Linux permissions: Forgetting what chmod 750 actually means? Convert 7, 5, 0 to binary: 111, 101, 000 — owner: rwx, group: r-x, others: nothing.
Hardware and embedded systems: Documentation for microcontrollers often specifies register values in hex. Converting to binary shows which individual bits are set, which maps to which hardware pin or feature.
Cryptography basics: Understanding hexadecimal is a prerequisite for reading cryptographic output — hash values, encrypted payloads, and certificate fingerprints are all expressed in hex.
Integers only. The converter handles whole numbers. Fractional binary (like 0.101 in binary representing 0.625 in decimal) requires a separate approach that this tool doesn't currently support.
JavaScript safe integer limit. Very large numbers above JavaScript's safe integer boundary (2^53 − 1 = 9,007,199,254,740,991) may not convert accurately due to floating-point precision limits in the underlying language. For cryptographic-scale numbers, use a purpose-built arbitrary-precision library.
Why do colours use 6 hex digits?
Each pair of hex digits represents one byte (0–255) for one colour channel: RR, GG, BB. #FFFFFF is white (all channels at maximum 255). #000000 is black (all at 0). #FF0000 is pure red.
What does "0x" mean before a hex number?
It's a programming convention signalling that what follows is a hexadecimal value. 0xFF = 255 decimal. 0x1A = 26 decimal. Most programming languages use this prefix to disambiguate.
Is hexadecimal case-sensitive?
No. FF, ff, and Ff all represent the same value (255). By convention, uppercase is used in memory addresses and hash values; lowercase is common in CSS colour codes.
Your data never leaves this device. All processing is handled locally by JavaScript.
Convert numbers between Binary, Decimal, Octal, and Hexadecimal instantly.
Binary (Base 2)
0b11111111
Octal (Base 8)
0o377
Hexadecimal (Base 16)
0xFF