Binary Converter
Convert between binary, octal, decimal and hexadecimal with the repeated-division working and the place-value table shown, exact to 2^53.
Binary Converter: with the default inputs, binary (base 2) is 1100 1010.
Whole numbers only. Its digits are read in the base you choose below; hexadecimal may use A–F.
- Octal (base 8)
- 312
- Decimal (base 10)
- 202
- Hexadecimal (base 16)
- CA
- Bits needed
- 8Length of the binary form, ignoring the sign.
Assumptions
- Whole numbers only; fractional parts are rejected rather than truncated.
- Negative values are shown with a minus sign, not in two's complement.
- Conversions run on arbitrary-precision integers, so they are exact for every input the field accepts (|value| ≤ 2^53 − 1).
| Number | ÷ 2 | Remainder |
|---|---|---|
| 202 | 101 | 0 |
| 101 | 50 | 1 |
| 50 | 25 | 0 |
| 25 | 12 | 1 |
| 12 | 6 | 0 |
| 6 | 3 | 0 |
| 3 | 1 | 1 |
| 1 | 0 | 1 |
Read the remainder column from the bottom up and you get 11001010 — that is the binary form.
| Bit | Place | Worth | Adds |
|---|---|---|---|
| 1 | 2^7 | 128 | 128 |
| 1 | 2^6 | 64 | 64 |
| 0 | 2^5 | 32 | 0 |
| 0 | 2^4 | 16 | 0 |
| 1 | 2^3 | 8 | 8 |
| 0 | 2^2 | 4 | 0 |
| 1 | 2^1 | 2 | 2 |
| 0 | 2^0 | 1 | 0 |
Adding the last column back up returns the decimal value — that is how you read binary by hand.
How this is worked out
The formula
To convert to base b: divide repeatedly by b and read the remainders bottom-up. To convert from base b: multiply each digit by b raised to its position and add. Binary → octal: group bits in threes (2³ = 8). Binary → hex: group bits in fours (2⁴ = 16). Exact for |value| ≤ 9,007,199,254,740,991 = 2^53 − 1.
Open How it’s calculated above to see this worked through with your own numbers.
What you enter
- Number
- Whole numbers only. Its digits are read in the base you choose below; hexadecimal may use A–F.up to 64 characters · defaults to "202"
- The number above is written in
- Choose one of 4 options.Base 2 — binary · Base 8 — octal · Base 10 — decimal · Base 16 — hexadecimal
What you get back
- Binary (base 2)main answer
- Octal (base 8)
- Decimal (base 10)
- Hexadecimal (base 16)
- Bits needed
- Length of the binary form, ignoring the sign.
What this assumes
- Whole numbers only; fractional parts are rejected rather than truncated.
- Negative values are shown with a minus sign, not in two's complement.
- Conversions run on arbitrary-precision integers, so they are exact for every input the field accepts (|value| ≤ 2^53 − 1).
About this calculator
Every number base works the same way — only the size of the bundle changes. Decimal bundles in tens, binary in twos, octal in eights, hexadecimal in sixteens. This converter shows the value in all four at once, along with the two methods you would use by hand.
How to use it
Type a whole number and tell the calculator which base its digits are already written in. The default is decimal, which is the common case ("what is 202 in binary?"). Choosing base 2 or base 8 lets you go the other way: enter 11001010 with base 2 selected and you get 202 back.
One honest limitation: the input is a numeric field, so it cannot accept the letters A–F. Hexadecimal input is therefore restricted to values written with the digits 0–9. To read a hex number containing letters, work in the other direction — enter the decimal value and read the hex output.
How to read the results
Binary is grouped in fours for readability, because each group of four bits is exactly one hexadecimal digit. That is the whole reason hexadecimal exists: 1100 1010 is C A, and you can do the translation nibble by nibble without any arithmetic. Octal works the same way with groups of three bits, which is why Unix file permissions (rwx, three bits) are written in octal.
The repeated division table shows the standard hand method: divide by 2, write the remainder, repeat, then read the remainders from the bottom up. The place values table shows the reverse: each 1 bit contributes its power of two, and the column adds back to the decimal value.
Where precision ends
The exact limit is 2^53 − 1 = 9,007,199,254,740,991. Below that every integer has a unique representation as a JavaScript number and every conversion here is exact. Above it, consecutive integers start sharing a representation, so the digits are lost before the converter ever sees them — which is why the input is capped there rather than quietly returning a wrong answer. The base conversions themselves are done with arbitrary-precision integers, so nothing is lost in the conversion step.
What this does not do
Fractions are excluded on purpose: 0.1 in decimal is a repeating expansion in binary (0.0001100110011…), which is the root cause of the classic 0.1 + 0.2 ≠ 0.3 surprise. Negative numbers are shown with a minus sign, not in two's complement — for the fixed-width, two's-complement view that programming languages actually use, see the bitwise calculator.
Frequently asked questions
▸How do I convert decimal to binary by hand?
Divide by 2 over and over, writing down each remainder, then read the remainders from the bottom up. The repeated-division table above shows every step for your number.
▸Why is hexadecimal used in computing?
Because 16 is 2⁴, so one hex digit is exactly four bits. A byte is two hex digits, and you can convert between hex and binary by sight without any arithmetic.
▸Why can't I type letters like FF?
The input is a numeric field, so it only accepts 0–9. Enter 255 in decimal instead and read FF from the hexadecimal output.
▸How many bits do I need for a number?
⌈log₂(n + 1)⌉ — the length of its binary form, which is reported directly. 202 needs 8 bits; 256 needs 9.
▸What is the largest number this handles exactly?
9,007,199,254,740,991, which is 2^53 − 1. That is the largest integer a double-precision number can represent without gaps, so it is where exactness genuinely ends rather than an arbitrary cap.
Put this calculator on your own site
A working binary, free for any site, with no ads and no sign-up. It resizes to fit wherever you paste it and updates itself as this page improves.
Paste this anywhere. It works on any site, carries no ads, never expires, and always shows the current version.
Binary Converter by CalculateItNow
The page's own title. The clearest description of what the link leads to.
The credit line sits outside the widget on purpose, so it is a real link on your page rather than one buried in a frame. Please keep it — it is what pays for CalculateItNow staying free and ad-free. The script only resizes the widget to fit its contents; drop it and the widget still works.
Browse every calculator widget·How to add it to WordPress, Squarespace or Wix
Related calculators
The questions people ask next to a binary.
AND, OR, XOR, NOT and left/right shifts on two integers, shown in decimal, 32-bit two's-complement binary and hex, with every operation compared side by side.
a mod b with the quotient and remainder, showing where the mathematical modulo and the % operator in C, Java and JavaScript disagree on negative numbers.
Convert bits, bytes, KB, MB, GB and TB — and the binary KiB, MiB, GiB, TiB — and see why a 1 TB drive shows up as 931 GB. Decimal vs binary explained.
Convert any number from 1 to 3,999 into Roman numerals with each place value shown, plus charts of 1–100, hundreds, thousands and famous years like MCMXCIV.
Convert any number to scientific, engineering and E notation with chosen significant figures, or expand a × 10ⁿ back to a plain decimal — exactly, no float noise.