How to use it
- Type a number in the field of the base you have – binary, octal, decimal, hexadecimal or a custom base from 2 to 36. Prefixes such as 0x and 0b and separators (spaces, underscores, commas) are ignored.
- The other fields update as you type; the result panel lists every base with a copy button.
- Read the place-value table to see how each digit contributes (digit × base^position) and where the decimal value comes from.
- For a negative number, or to see a fixed-width pattern, pick 8, 16, 32 or 64 bits under Two’s complement.
Example
Hex 2f to decimal: 2 × 16¹ + 15 × 16⁰ = 32 + 15 = 47. To binary, replace each hex digit by four bits: 2 = 0010, f = 1111, so 2f = 0010 1111 = 101111. Decimal 47 to octal by repeated division: 47 ÷ 8 = 5 remainder 7, 5 ÷ 8 = 0 remainder 5, read the remainders upwards: 57. And −47 in 8-bit two’s complement is 256 − 47 = 209 = 1101 0001 (d1).
How the conversion works
A number written with digits dn … d1 d0 in base b has the value
value = dₙ·bⁿ + … + d₁·b¹ + d₀·b⁰
1011₂ = 1·8 + 0·4 + 1·2 + 1·1 = 11To write a value in another base, divide by that base repeatedly and collect the remainders from last to first (255 ÷ 16 = 15 r 15 → ff). Because 8 = 2³ and 16 = 2⁴, binary groups of three bits map directly to octal digits and groups of four to hex digits, which is why programmers prefer hex for bytes, addresses and colours (#ff8800). The tool keeps every value as an arbitrary-precision integer, so inputs longer than 64 bits convert exactly; fractional values are not supported.
Two’s complement represents a negative number −x in w bits as 2w − x, so the top bit is 1 for negatives and arithmetic wraps naturally. An 8-bit signed integer runs from −128 (80) to 127 (7f); the same pattern 80–ff reads as 128–255 when treated as unsigned. The converter reports when a positive input has its top bit set for the chosen width.
Conversion table
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 |
| 2 | 10 | 2 | 2 |
| 7 | 111 | 7 | 7 |
| 8 | 1000 | 10 | 8 |
| 10 | 1010 | 12 | a |
| 15 | 1111 | 17 | f |
| 16 | 10000 | 20 | 10 |
| 100 | 1100100 | 144 | 64 |
| 255 | 11111111 | 377 | ff |
| 256 | 100000000 | 400 | 100 |
| 1,024 | 10000000000 | 2000 | 400 |
| 4,095 | 111111111111 | 7777 | fff |
| 65,535 | 1111111111111111 | 177777 | ffff |
Sources: Wikipedia – Positional notation, Wikipedia – Two’s complement, MDN – BigInt (arbitrary-precision integers used by this tool).
Prefixes and notation
Programming languages mark the base with a prefix: 0b1010 (binary), 0o12 or a leading 0 (octal, in C), 0xa (hexadecimal). In mathematics a subscript is used instead: 1010₂ = 12₈ = 10₁₀ = a₁₆. Letters in hex may be upper or lower case; CSS colour codes, MAC addresses and hashes are hex; base 32 and base 36 (digits plus the whole alphabet) appear in short URLs and licence keys.
Questions
- How do I convert binary to decimal?
- Add up the place values of every 1 bit, doubling from 1 at the right: 1011 = 8 + 0 + 2 + 1 = 11. The place-value table in the tool shows exactly this sum.
- How do I convert decimal to hexadecimal?
- Divide by 16 repeatedly and write the remainders backwards, using a–f for 10–15: 255 ÷ 16 = 15 r 15, 15 ÷ 16 = 0 r 15, so 255 = ff. 4,096 = 1000 hex.
- What is −1 in binary?
- There is no single answer without a width. With a sign it is simply −1; in 8-bit two’s complement it is 11111111 (ff), in 16 bits ffff and in 32 bits ffffffff. Select the width in the tool to see each form.
- Can it convert very large numbers?
- Yes. Values are handled as arbitrary-precision integers, so a 256-bit hash or a 100-digit decimal converts exactly; the place-value breakdown is shown for inputs of up to 32 digits.