CalculateItNow home

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.

Try an example
Binary (base 2)
1100 1010
Octal (base 8)
312
Decimal (base 10)
202
Hexadecimal (base 16)
CA
Bits needed
8
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).
Repeated division by 2
Number÷ 2Remainder
2021010
101501
50250
25121
1260
630
311
101

Read the remainder column from the bottom up and you get 11001010 — that is the binary form.

Place values in binary
BitPlaceWorthAdds
12^7128128
12^66464
02^5320
02^4160
12^388
02^240
12^122
02^010

Adding the last column back up returns the decimal value — that is how you read binary by hand.

Math verified by automated testsUpdated 2026-09-092 sources cited

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

The questions people ask next to a binary.

All math calculators·Browse everything