What a number base is
Every number you have ever written in school uses the same hidden machinery: a row of digits, where each position is worth a fixed multiple of the position to its right. In decimal, that multiple is ten. The number 255 means two hundreds, five tens and five ones — 2 × 100 + 5 × 10 + 5 × 1. Nothing about that idea requires the multiplier to be ten. It is ten because humans have ten fingers, not because mathematics prefers it. Choose a different multiplier and you get a different number system, with its own digit set and its own spelling for every value.
That is all a base converter does: it takes a value written in one base and respells it in another, exactly. 255 in decimal is FF in hexadecimal, 11111111 in binary and 377 in octal — four spellings, one quantity. Conversion is translation, not transformation, and a correct translation can always be translated back to the identical original.
Two rules follow from the definition, and they explain almost every error message this tool can give. First, a base-b system has exactly b digits, starting at 0 and ending at b − 1. Binary has two digits (0 and 1), octal has eight (0–7), and decimal has ten (0–9). The digit 2 simply does not exist in binary, the way the letter Q does not exist in a word game that only dealt you vowels. Second, when a base needs more than ten digits, letters take over: A stands for 10, B for 11, and so on, reaching F for 15 in hexadecimal and Z for 35 in base 36. Letters in a number are not a trick — they are digits that ran out of familiar symbols.
Binary, octal, decimal and hex side by side
| Decimal (10) | Binary (2) | Octal (8) | Hex (16) |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 |
| 2 | 10 | 2 | 2 |
| 3 | 11 | 3 | 3 |
| 4 | 100 | 4 | 4 |
| 5 | 101 | 5 | 5 |
| 6 | 110 | 6 | 6 |
| 7 | 111 | 7 | 7 |
| 8 | 1000 | 10 | 8 |
| 9 | 1001 | 11 | 9 |
| 10 | 1010 | 12 | A |
| 11 | 1011 | 13 | B |
| 12 | 1100 | 14 | C |
| 13 | 1101 | 15 | D |
| 14 | 1110 | 16 | E |
| 15 | 1111 | 17 | F |
Read the table row by row and two patterns stand out. The smaller the base, the longer the spelling: fifteen needs four binary digits, two octal digits, two decimal digits and a single hex digit. And the counting rhythm is identical in every column — a position rolls over to 0 and carries 1 exactly when it exhausts its digits. Octal counts …6, 7, 10, 11… because after 7 there is no next digit, exactly as decimal counts …8, 9, 10. Once that rollover feels natural in octal and hex, every conversion in this guide becomes bookkeeping rather than mystery.
Place values and powers
| Position | Binary (×2) | Octal (×8) | Decimal (×10) | Hex (×16) |
|---|---|---|---|---|
| 5th (b⁴) | 16 | 4,096 | 10,000 | 65,536 |
| 4th (b³) | 8 | 512 | 1,000 | 4,096 |
| 3rd (b²) | 4 | 64 | 100 | 256 |
| 2nd (b¹) | 2 | 8 | 10 | 16 |
| 1st (b⁰) | 1 | 1 | 1 | 1 |
| 1st after point (b⁻¹) | 1/2 | 1/8 | 1/10 | 1/16 |
| 2nd after point (b⁻²) | 1/4 | 1/64 | 1/100 | 1/256 |
| 3rd after point (b⁻³) | 1/8 | 1/512 | 1/1,000 | 1/4,096 |
The powers table is the Rosetta Stone for hand conversion. To turn binary 11111111 into decimal, lay the digits over the binary place values — 128, 64, 32, 16, 8, 4, 2, 1 — and add the positions holding a 1: every position is filled, so the total is 255. To turn hex 2A into decimal, use the hex places: 2 × 16 + 10 × 1 = 42, remembering that the digit A is worth ten. Octal 377 reads the same way over powers of eight: 3 × 64 + 7 × 8 + 7 × 1 = 255 again. Three spellings, three sums, one value — that agreement is the definition of a correct conversion.
Notice the after-point rows, because they govern everything in the fractions section below. A digit after the point is worth a fraction — halves, quarters and eighths in binary; tenths and hundredths in decimal; sixteenths and 256ths in hex. A value like binary 0.1 is not "point one" in any decimal sense: it is one half. Binary 1010.101 is 8 + 2 + 1/2 + 1/8, which is decimal 10.625. Keeping place values in view turns fraction conversion from a black box into the same multiply-and-add you already know.
How base conversion works
There are two directions, and each has a classic hand method. To convert from any base to a value you understand, expand it: multiply each digit by its place value and add, as the previous section showed. A computer does the same thing more efficiently with Horner's rule — start at zero, and for each digit from the left, multiply the running total by the base and add the digit. Binary 11111111 builds up as 1, 3, 7, 15, 31, 63, 127, 255: eight small steps, no powers table required.
To convert into a new base, divide. Repeatedly divide the value by the target base and keep the remainders; the remainders, read in reverse order, are the digits. Decimal 255 into hex: 255 ÷ 16 = 15 remainder 15 (F), then 15 ÷ 16 = 0 remainder 15 (F) — read upwards, FF. Decimal 255 into binary gives eight divisions and eight remainders of 1 — 11111111. The last digit of any conversion is always the first remainder, which gives you a fast sanity check: the last binary digit is the value's odd-or-even remainder, so an odd number must end in 1 in binary, and 255 in hex must end in F because 255 leaves remainder 15 on division by 16.
Fractions convert by the mirror-image method: instead of dividing, multiply. Take the fractional part, multiply it by the target base, and the whole-number part of the product is the next digit; repeat with what remains. Decimal 0.625 into binary: 0.625 × 2 = 1.25 (digit 1), 0.25 × 2 = 0.5 (digit 0), 0.5 × 2 = 1.0 (digit 1) — giving 0.101, and the process stops because nothing remains. This tool performs the same process with exact fractions — a numerator and denominator held as big integers — so no floating-point fuzz ever creeps into the digits it shows.
Worked examples
| Input | From → To | Result | Check |
|---|---|---|---|
| 255 | Decimal → Hex | FF | 15 × 16 + 15 = 255 |
| 255 | Decimal → Binary | 11111111 | 128+64+32+16+8+4+2+1 = 255 |
| 255 | Decimal → Octal | 377 | 3 × 64 + 7 × 8 + 7 = 255 |
| 2A | Hex → Decimal | 42 | 2 × 16 + 10 = 42 |
| 10.625 | Decimal → Binary | 1010.101 | 8 + 2 + 1/2 + 1/8 = 10.625 |
| 0.5 | Decimal → Binary | 0.1 | 1 × 1/2 = 0.5 |
| 123456789012345678901234567890 | Decimal → Hex → Decimal | 18EE90FF6C373E0EE4E3F0AD2 | Converting the hex back returns the identical 30 digits |
The first three rows are the same value wearing three costumes, and they are worth doing by hand once: 255 is the largest value one byte can hold, which is why FF, 11111111 and 377 recur throughout computing — colour channels top out at FF, permission bits fill all three octal digits, and network masks are built from 255s. The 2A row is the everyday hex to decimal converter job in miniature, and it shows why the letter digits matter: without A meaning ten, the row could not be written at all.
The fraction rows reward a second look. 10.625 splits cleanly into a whole part (1010) and a fraction (0.101) because 0.625 is 5/8 — a sum of binary fractions. 0.5 is the simplest possible case, a single binary digit after the point. Contrast both with decimal 0.1, which has no finite binary form at all; the fractions section below explains why, and why this tool truncates it honestly at 32 digits instead of inventing an ending.
Very large numbers and BigInt exactness
Most calculators, spreadsheets and quick scripts store numbers as double-precision floating point, which carries about 15 to 17 significant decimal digits. Paste a 30-digit integer into one of those tools and the last thirteen or so digits are silently replaced with a rounded approximation — the display may still show a long number, but it is no longer your number. For a base converter calculator that failure is fatal, because base conversion is precisely the job where every digit is the answer: a checksum, a hash fragment, a serial number or a cryptographic value is wrong if any digit is wrong.
BigInt removes the ceiling. A BigInt is an integer stored with as many digits as it needs, and its arithmetic — multiply, add, divide, remainder — is exact at any size. This tool builds the value as a BigInt digit by digit (Horner's rule, from the methods section), then renders it into the target base with exact divisions. The worked example in the table above is the proof you can repeat yourself: 123456789012345678901234567890 in decimal is 18EE90FF6C373E0EE4E3F0AD2 in hex, and feeding that hex straight back returns the original thirty digits, character for character. Try the same round trip in a spreadsheet and watch the tail of the number change.
Exactness has one honest boundary worth stating: it applies to the whole-number part. The fractional part is converted with exact rational arithmetic too, but a fraction that repeats forever in the target base has infinitely many digits, and a screen can only show finitely many — so fractions are capped at 32 digits and truncated, as the next section explains. Integers never repeat and never need capping: a whole number converts completely, however long it is.
Fractions in other bases
A terminating fraction is a lucky fraction. In decimal, 1/2, 1/4, 1/5, 1/8 and 1/10 all terminate because 2 and 5 — the factors of ten — divide their denominators. In binary the only factor is 2, so only fractions built from halves, quarters, eighths and their sums terminate: 0.5 is 0.1, 0.625 is 0.101, and 10.625 is 1010.101. But 1/10 needs the factor 5, which binary does not have, so decimal 0.1 in binary is 0.0001100110011… with "0011" repeating forever — the exact mirror of 1/3 repeating in decimal, a fact the NIST reference on computer arithmetic discusses in the context of rounding error.
This tool's policy for that situation is stated on the tool itself, not buried here: it shows the first 32 fractional digits of the true value and stops. It truncates — it does not round the 32nd digit up or down based on what follows — so the digits you see are always the true leading digits of the exact value. Thirty-two digits is far beyond any practical need (a double-precision float carries about 17 significant decimal digits in total), while still keeping results copyable. If a fraction terminates sooner, the tool stops at the exact end and never pads with invented zeros.
Why only bases 2, 8, 10 and 16 for fractions? Because those are the bases where fractional work is real: binary and hex fractions appear in floating-point internals and fixed-point embedded code, octal in legacy systems, decimal everywhere else. A general fraction engine for base 7 or base 29 would mostly serve to produce long, unverifiable digit strings, and would invite exactly the silent-error failure this page is built to avoid. Whole numbers, by contrast, are exact and verifiable in every base, so they are offered for all bases 2 to 36 without restriction.
Beyond hex: bases up to 36
Nothing in the place-value machinery stops at 16. Give a system twenty digits and positions multiply by twenty; give it thirty-six and a three-character string can name 46,655 different values, which is why base 36 is a workhorse for compact identifiers: URL shorteners, order references and session codes are often base-36 (or a close cousin) precisely because letters-plus-digits packs the most value into the fewest characters a person can still type. This tool converts directly between any two bases in the range — base 5 to base 20 needs no decimal detour, because the conversion runs through the exact value, not through a decimal display.
Where each base is actually used
Binary earns its place because a transistor has two comfortable states. Everything a computer stores — numbers, text, images — is bits underneath, and some jobs still speak binary directly: network subnet masks, bit flags packed into a single integer, embedded register settings, and the permission bits discussed below. Reading binary fluently matters less than recognising its patterns: a run of eight 1s is 255, a single 1 followed by zeros is always a power of two, and the last digit tells you odd from even at a glance.
Hexadecimal is binary with the verbosity removed. Because 16 is 2⁴, every hex digit corresponds to exactly four binary digits, so converting between them is pure grouping — 11111111 splits as 1111 1111 and becomes FF with no division at all. That is why hex is the spelling of colour codes (#FF5733), memory addresses and dumps, MAC addresses, hash values and byte-oriented debugging everywhere. Octal's grouping is three bits per digit, and its living fossil is the Unix permission system: chmod 755 means 111 101 101, read-write-execute for the owner and read-execute for everyone else — a fact that only makes sense once octal and binary are seen as the same number in two typefaces.
Decimal remains the right base wherever humans count, measure or pay, and the honest summary is that most conversions start or end there: a student turning a decimal answer into the binary a textbook demands, a developer turning a hex error code into the decimal a log search needs, an engineer reading an octal dump as a decimal quantity. That is exactly the traffic this page is built for — a binary to decimal converter, a hex to decimal converter, an octal to decimal check and every other pairing, in one place, with all four answers always visible together.
Common mistakes and invalid digits
The invalid-digit error is the one you will meet most, and it is a feature. Type "2" with the From base set to binary and there is no honest answer to give — the input is not a binary number. A looser tool might silently treat it as decimal and hand you a confident, wrong result. This converter stops and tells you the digit, the base and the digits that base allows, because in practice the mistake is almost always in the setup, not the number: the value was hex but the base said octal, or the value was decimal but the base said binary. Fix the base and the same input usually converts cleanly.
Prefixes are the second trap. Programmers write binary as 0b1010, hex as 0xFF and sometimes octal as 0o377, and those prefixes are labels for humans and compilers — they are not digits. Pasted into this tool, the x in 0xFF is not a valid hex digit and the conversion stops. Strip the prefix and convert the digits alone. Grouping characters are the third trap: spaces, commas and underscores that people add to long numbers for readability (1,000,000 or 1111_1111) must come out before converting, and the tool says so rather than guessing where the groups belong.
The last family of mistakes is conceptual rather than typographical. Reading hex FF as "two hundred and fifty-five… no, two thousand…" by applying decimal place values to hex digits; assuming the fraction point works like decimal in every base (binary 0.1 is a half, not a tenth); and expecting a repeating fraction to end if you just scroll further. Each of these is answered by the same habit: check the place values, check the base, and convert back — the Swap button exists precisely so the round trip takes one click.
What this tool does not do: signs and two's complement
The distinction matters because computing really does store negative integers, and it stores them in a way that surprises people meeting it for the first time. In an 8-bit two's-complement system, −1 is stored as 11111111 — the same bit pattern this converter reports for the unsigned value 255. Neither answer is wrong; they are answers to different questions. "What is 255 in binary?" is a question about magnitude. "How is −1 stored in 8 bits?" is a question about an encoding with a fixed width and a sign convention, and its answer changes with the width: −1 in 16 bits is sixteen 1s, not eight.
A converter that quietly blurred those questions would produce the most dangerous kind of wrong answer — a plausible one. So this page draws the line in plain sight: enter a negative number and you are told, in the error itself, that signed and two's-complement handling is not done here, and that converting the magnitude is available if that is genuinely what you need. The same honesty applies to the other boundaries already stated: fractions only between bases 2, 8, 10 and 16, shown to 32 truncated digits; integers exact at any size; nothing uploaded, ever — the whole conversion happens in your browser tab, and closing the tab discards everything.
Sources & References
Every source below was checked live in November 2026 and returned HTTP 200 at the time of checking. No substitutions were needed: each source is listed at the address originally intended for it.
- MDN — BigInt — the arbitrary-precision integer type this converter uses for the whole-number part, which is why 30-digit and larger integers convert exactly instead of rounding.
- MDN — BigInt.prototype.toString() — documents the radix argument (2 to 36) used to render a BigInt in another base — the range this tool's From and To bases follow.
- MDN — parseInt() — the classic radix reference: how digit strings are read in a given base, and why a digit that is too large for the base cannot be parsed.
- Khan Academy — Hexadecimal numbers — a clear place-value explanation of base 16, why A to F stand for 10 to 15, and why one hex digit is exactly four binary digits.
- Khan Academy & Code.org — Binary numbers — how binary place values (1, 2, 4, 8, 16…) build any value from 0s and 1s — the method behind the binary-to-decimal examples in this guide.
- NIST Digital Library of Mathematical Functions — §3.1 Arithmetics and Error Measures — the NIST reference on binary and hexadecimal arithmetic and rounding error, including why decimal fractions such as 0.1 have no exact binary form.
- ECMAScript Language Specification — Numbers and Dates — the standard that defines JavaScript's Number and BigInt behaviour in the browser, including the exact integer arithmetic this tool relies on.