Base Converter
Convert numbers between any bases.
Reviewed by the Calculation Machine team · Updated 24 October 2026 · How we check our maths
Your values
ⓘ Live results
- Base 16
- FF
- Decimal
- 255
- Binary
- 11111111
- Octal
- 377
- Hexadecimal
- FF
Quick answer
A number base sets how many digits are used before a place value rolls over: base 2 uses 0–1, base 8 uses 0–7, base 10 uses 0–9 and base 16 uses 0–9 then A–F. Converting changes how a value is written, not the value itself. Decimal 255 is 11111111 in binary, 377 in octal and FF in hexadecimal.
What the Base Converter does
This converter rewrites a whole number from binary, octal, decimal or hexadecimal into any base from 2 to 36, and always shows the decimal, binary, octal and hex forms alongside. Programmers use it for bit masks, memory addresses, color codes and Unix file permissions; students use it to check base-conversion homework.
Bases above 10 use letters for the extra digits: A = 10, B = 11 and so on up to Z = 35 in base 36. Letters are not case-sensitive, so ff and FF are the same hex number.
The converter works with whole numbers only — digits after a decimal point are dropped — and is exact up to 9,007,199,254,740,991 (2⁵³ − 1), the largest integer JavaScript stores exactly. Make sure every digit is valid for the base you choose: a 2 in a binary number or a G in a hex number is not a valid digit. For two's-complement and bit-level work, the binary converter is more specialized.
The formula
Value = dₙ × bⁿ + … + d₂ × b² + d₁ × b + d₀ To base b: divide by b repeatedly; the remainders, read last to first, are the digits
| Symbol | Meaning | Unit |
|---|---|---|
| d | Digit in each position, counted from the right starting at position 0 | — |
| b | Base (radix): 2 for binary, 8 octal, 10 decimal, 16 hex, up to 36 | — |
| n | Position of the leftmost digit | — |
This is positional notation, the same system decimal numbers use. Converting into decimal uses the expanded sum; converting out of decimal uses repeated division. Between binary, octal and hex there is a shortcut: each octal digit is exactly 3 bits and each hex digit exactly 4 bits, so you can convert group by group without going through decimal.
Worked examples
Binary byte to hexadecimal
A register value read as the byte 11010110 needs to be written in hex.
Inputs
- Number11010110
- From baseBinary (2)
- To base16
Result
- Base 16D6
- Decimal214
- Binary11010110
- Octal326
- HexadecimalD6
Split into nibbles: 1101 = D and 0110 = 6, so the byte is D6 (decimal 214). Every byte is exactly two hex digits, which is why hex is used for memory dumps.
Unix file permissions
Converting the chmod permission 755 from octal to binary to see which bits are set.
Inputs
- Number755
- From baseOctal (8)
- To base2
Result
- Base 2111101101
- Decimal493
- Binary111101101
- Octal755
- Hexadecimal1ED
755 becomes 111 101 101: read, write and execute for the owner (7), and read and execute for group and others (5 each). Each octal digit maps to exactly three permission bits.
Short IDs in base 36
Encoding the decimal number 1000 in base 36, which uses all digits and letters, for a compact identifier.
Inputs
- Number1000
- From baseDecimal (10)
- To base36
Result
- Base 36RS
- Decimal1,000
- Binary1111101000
- Octal1750
- Hexadecimal3E8
1000 is RS in base 36 (27 × 36 + 28). Base 36 packs large numbers into few characters, which is why it appears in URL shorteners and reference codes.
Common values in binary, octal and hex
Powers of two look round in binary and hex, which is why they show up so often in computing.
| Decimal | Binary | Octal | Hexadecimal |
|---|---|---|---|
| 10 | 1010 | 12 | A |
| 15 | 1111 | 17 | F |
| 16 | 10000 | 20 | 10 |
| 64 | 1000000 | 100 | 40 |
| 100 | 1100100 | 144 | 64 |
| 127 | 1111111 | 177 | 7F |
| 255 | 11111111 | 377 | FF |
| 256 | 100000000 | 400 | 100 |
| 1024 | 10000000000 | 2000 | 400 |
Converting by hand: decimal to binary and back
Decimal to any base: divide by the base, write down the remainder, and repeat with the quotient until it reaches 0. Read the remainders from last to first. For 42 to binary: 42 ÷ 2 = 21 r0, 21 ÷ 2 = 10 r1, 10 ÷ 2 = 5 r0, 5 ÷ 2 = 2 r1, 2 ÷ 2 = 1 r0, 1 ÷ 2 = 0 r1, so 42 = 101010.
Any base to decimal: multiply each digit by the base raised to its position and add. For hex 2A: 2 × 16 + 10 × 1 = 42.
Binary to hex: group bits in fours from the right (pad with leading zeros) and replace each group with one hex digit: 0010 1010 = 2A.
Where each base is used
- Binary (base 2): how computers store everything; used for bit flags, masks and network subnet calculations.
- Octal (base 8): Unix and Linux file permissions (chmod 644, 755) and some older computing systems.
- Decimal (base 10): everyday arithmetic.
- Hexadecimal (base 16): memory addresses, byte values, web colors (#FF8800 is red 255, green 136, blue 0) and MAC addresses.
- Base 36: compact alphanumeric IDs.
For other number formats, the Roman numeral converter and scientific notation converter handle notations that are not positional bases.
How to use the Base Converter
- 1Enter the number using digits valid for its base (0–1 binary, 0–7 octal, 0–9 decimal, 0–9 and A–F hex).
- 2Choose the base the number is written in.
- 3Enter the target base, any whole number from 2 to 36.
- 4Read the result, plus the decimal, binary, octal and hex forms for cross-checking.
Frequently asked questions
How do you convert decimal to hexadecimal?
Divide by 16 repeatedly and write the remainders as hex digits (10–15 become A–F), reading from last to first. 255 ÷ 16 = 15 r15, 15 ÷ 16 = 0 r15, giving FF.
What is 255 in binary?
11111111 — eight 1s, the largest value one byte can hold. 256 needs a ninth bit: 100000000.
Why do programmers use hexadecimal?
One hex digit represents exactly four bits, so a byte is always two hex digits. That makes binary data far shorter to read and write than raw 1s and 0s, without the awkward conversion decimal needs.
What is the highest base this converter supports?
Base 36, which uses the ten digits plus the 26 letters of the alphabet. Higher bases need extra symbols that have no standard convention.
Can I convert numbers with a fractional part?
Not with this tool; it converts the whole-number part only. Fractions convert by repeatedly multiplying by the base, and many decimal fractions, such as 0.1, never end in binary.
References
- The Art of Computer Programming, Volume 2: Seminumerical Algorithms (Section 4.1, Positional Number Systems) — Addison-Wesley (Donald E. Knuth)
- ECMAScript Language Specification (Number type and Number.MAX_SAFE_INTEGER) — Ecma International
About this calculator
- Built and reviewed by the Calculation Machine team · How we build and test calculators
- Last reviewed: October 24, 2026
- Report an error