Number converter · Free · No sign-up

Binary Converter

Short answer

A binary converter rewrites a number in another base: 2026 in decimal is 11111101010 in binary, 3752 in octal and 7EA in hex. This one converts between any bases from 2 to 36, keeps big numbers and fractions exact with repeating digits marked, shows two's complement at 8 to 64 bits, and writes out the working.

Binary, octal, decimal, hex or any base up to 36.

11111101010In decimal: 2026.2026 in decimal =
  1. Divide 2026 by 2 again and again, writing down each remainder.
  2. 2026 ÷ 2 = 1013 remainder 0
  3. 1013 ÷ 2 = 506 remainder 1
  4. 506 ÷ 2 = 253 remainder 0
  5. 253 ÷ 2 = 126 remainder 1
  6. 126 ÷ 2 = 63 remainder 0
  7. 63 ÷ 2 = 31 remainder 1
  8. 31 ÷ 2 = 15 remainder 1
  9. 15 ÷ 2 = 7 remainder 1
  10. 7 ÷ 2 = 3 remainder 1
  11. 3 ÷ 2 = 1 remainder 1
  12. 1 ÷ 2 = 0 remainder 1
  13. Read the remainders from the last to the first: 11111101010.
The number in every common base
FormValue
Binary (base 2)11111101010
Octal (base 8)3752
Decimal (base 10)2026
Hexadecimal (base 16)7EA
Binary in groups of four111 1110 1010

The figures above are an example: put in your own. Spaces and underscores between digit groups are ignored, and 0b, 0o, 0x or # in front are read when they match the base. Worked out exactly in this browser and kept there; nothing is sent anywhere. For the step-by-step pages see binary to decimal and hex to decimal.

Type a number, choose the base it is in and the base you want, and read the answer with its working. Every common base is in the table at once. Set a bit width to see a negative number as the pattern a computer stores.

A binary converter (or number base converter) rewrites a number from one positional system into another, such as decimal 45 into binary 101101. The value is the same; only the base, and so the digits, change.

  • No sign-up
  • Nothing uploaded
  • Shows every step
  • Works offline
  • Exact, any size

Key facts

Binary converter at a glance
DetailAnswer
BasesAny from 2 to 36 (digits 0 to 9, then A to Z)
Example2026 = 11111101010 in binary = 3752 octal = 7EA hex
SizeUp to 256 characters, exact (BigInt), so 64-bit and larger values are never rounded
FractionsExact; repeating digits in brackets, as in 0.1 = 0.0(0011) in binary
Signed numbersTwo's complement at 8, 16, 32 or 64 bits
Where your numbers are keptThis browser only

How to convert a number between bases

Enter the number, pick the two bases, and read the working; the same steps work by hand.

  1. Type the number

    Digits only, with an optional point and minus sign; 0x, 0b, 0o or # are read if they match.

  2. Choose the base it is in

    From base: 2 for binary, 8 octal, 10 decimal, 16 hex, or any up to 36.

  3. Choose the base you want

    To base: the big result; the table shows binary, octal, decimal and hex anyway.

  4. Turn on two's complement if needed

    Pick 8, 16, 32 or 64 bits to see a negative number as its bit pattern.

  5. Read the working

    Place values to decimal, then repeated division, and the grouping shortcut where it applies.

  6. Swap or copy

    Swap the bases to go back, or copy the result or the full working as text.

Who uses a binary converter

Anyone moving a number between the way people write it and the way a machine stores it.

  • Computing students

    Base conversion and two's complement homework, with working to check.

  • Programmers

    Bit masks, flags and register values in binary, hex and decimal at once.

  • Network engineers

    Subnet masks and addresses read bit by bit.

  • Electronics hobbyists

    Register and port values for microcontrollers.

  • Web designers

    Hex colour codes read as numbers.

  • Puzzle and code fans

    Base 36 IDs and odd bases worked out exactly.

Why big numbers and fractions go wrong in other converters

Most online converters do the arithmetic in JavaScript numbers, which are 64-bit floating point. MDN’s reference for Number.MAX_SAFE_INTEGER puts the limit plainly: integers are only exact up to 253 − 1, which is 9,007,199,254,740,991. Past that, a float cannot tell 9,007,199,254,740,993 from 9,007,199,254,740,992, so a converter built on floats prints the wrong bits for a large 64-bit value without any warning. Fractions fail the other way. The Python tutorial on floating point shows that 1/10 in binary is the endless fraction 0.000110011001100…, and a float keeps only the nearest 53-bit approximation of it.

What a floating-point converter shows against the exact answer
EntryFloating-point converterThis converter
9007199254740993 to binary1 followed by 53 zeros (that is 253, one too small)1, then 52 zeros, then 1
0.1 to binary0.0001100110011…1101 (55 places, then stops)0.0(0011): 0011 repeating for ever
0.1 to hex0.1999999999999A0.1(9)
264 − 1 to hex10000000000000000 (rounded up past 64 bits)FFFFFFFFFFFFFFFF

This converter holds every value as an exact fraction of two whole numbers of any size (JavaScript’s BigInt), so a 300-digit number converts digit for digit, and a fraction is followed until it ends or repeats. Repeating digits are put in brackets, as the fraction calculator does for decimals; a repeat longer than 64 places is cut there and marked with an ellipsis, so you can always tell an exact answer from a shortened one.

Which base is used where

Every positional system works the same way: each place is worth the base times the place to its right. Only the number of digits changes, which is why one converter can handle every base from 2 to 36: after 0 to 9 it uses the letters A to Z, so base 36 is the largest that needs no new symbols. To add, subtract, multiply or divide numbers in these bases, use the base calculator.

Where each base is used
BaseNameDigitsWhere you meet it
2Binary0 1Bits in memory, logic circuits, network masks (255.255.255.0 is 24 ones)
8Octal0 to 7Unix file permissions: chmod 755 is 111 101 101, read-write-run for the owner
10Decimal0 to 9Everyday counting
16Hexadecimal0 to 9, A to FBytes (00 to FF), colour codes, memory addresses, Unicode code points such as U+00E9
36Base 360 to 9, A to ZShort IDs in links and codes, because it packs the most into letters and digits

Bases above 36 exist (base 64 for e-mail attachments, base 60 for minutes and seconds), but they need symbols beyond 0 to 9 and A to Z, and they are encodings or mixed systems rather than numbers written one digit a place, so they are outside this tool.

Two's complement at 8, 16, 32 and 64 bits

A computer stores a negative whole number as a two’s complement bit pattern of fixed width. To make one, write the positive value in that many bits, invert every bit and add 1; to read one back, a 1 in the top bit means negative, and the value is the pattern minus 2 to the power of the width. Thomas Finley’s Cornell notes on two’s complement walk through the same invert-and-add-one rule on 8-bit and 32-bit examples. Set the width in the converter and it shows both readings, signed and unsigned, with the steps.

Signed two’s complement ranges by width
WidthLowestHighest−1 as a pattern (hex)
8-bit−128127FF
16-bit−32,76832,767FFFF
32-bit−2,147,483,6482,147,483,647FFFFFFFF
64-bit−9,223,372,036,854,775,8089,223,372,036,854,775,807FFFFFFFFFFFFFFFF

The width matters. The same eight bits 11111111 are 255 unsigned and −1 signed, and −1 in 16 bits is FFFF, not FF. A count that runs past the top of its width wraps round to the bottom, which is the overflow that binary hardware counters are built around. Ten fingers make a ten-bit register that wraps the same way, from 1,023 back to 0: see how to count to 1,023 on your fingers.

The grouping shortcut between binary, octal and hex

Because 16 is 24 and 8 is 23, binary turns into hex or octal without any division: split the bits into groups of four (for hex) or three (for octal), starting from the right, pad the leftmost group with zeros, and replace each group with its digit. 11111101010 becomes 0111 1110 1010, which is 7EA. The converter adds this shortcut to its working whenever you go between these bases.

The sixteen 4-bit groups and their hex and octal digits
BitsHex digitDecimalOctal
0000000
0001111
0010222
0011333
0100444
0101555
0110666
0111777
10008810
10019911
1010A1012
1011B1113
1100C1214
1101D1315
1110E1416
1111F1517

What this converter does not do

This converter works with numbers written digit by digit in one base. It is not an IEEE 754 floating-point encoder (the bit layout of a float or double), it does not do negative or fractional bases, and two’s complement is for whole numbers only. Entries are limited to 256 characters; a fraction that neither ends nor repeats within 64 places is cut and marked.

If what you hold is text rather than a number, such as a word, a log line or a hex dump, the ASCII, hex, binary and decimal converter turns each character into its byte codes in all of these bases and back. Binary is not the only code made of two symbols: the Morse code translator turns text into dots and dashes, with the spacing that makes them readable.

What this converter does and does not do
It doesIt does not
Any base from 2 to 36, both waysBases above 36, such as base 64 or base 60
Exact whole numbers of any length and exact fractionsRound through floating point
Two’s complement at 8, 16, 32 and 64 bitsEncode IEEE 754 floats
Show the workingSend your numbers anywhere

This converter or a typical one

This binary converter compared with a typical one
 This pageA typical one
BasesAny from 2 to 36Often 2, 8, 10 and 16 only
Numbers past 253ExactOften rounded silently
FractionsExact, repeats markedRounded or refused
Two's complement8 to 64 bits, explained step by stepA result without the steps
Working shownEvery step, numberedSometimes
Your numbers leave the browserNeverVaries

Frequently asked questions

How do you convert a number from one base to another?

Go through decimal. To reach decimal, multiply each digit by its place value (a power of the base) and add. To leave decimal, divide by the new base again and again and read the remainders from last to first. Between binary and hex or octal there is a shortcut: group the bits in fours or threes.

What is two's complement?

It is how computers store negative whole numbers in a fixed number of bits. Write the positive value, invert every bit and add 1: -42 in 8 bits is 11010110. A 1 in the top bit means negative, and an 8-bit pattern holds -128 to 127. Choose a bit width in the converter to see it.

What do 0b, 0o and 0x mean in front of a number?

They are prefixes from programming languages that say which base follows: 0b for binary, 0o for octal and 0x for hexadecimal, so 0x1F is 31. A # in front of six hex digits usually marks a colour. The converter reads these prefixes when they match the base you chose.

Why does 0.1 never end in binary?

A fraction ends in a base only if its denominator divides a power of that base. One tenth needs a factor of 5, which no power of 2 has, so in binary it repeats for ever: 0.0(0011). That is why 0.1 + 0.2 is not exactly 0.3 in most programming languages.

What is the largest number this converter can handle?

Any number you can type in 256 characters, exactly. It uses whole-number arithmetic of unlimited size instead of floating point, so 2^64 - 1 and 300-digit values convert digit for digit. Fractions are followed until they end or repeat, or cut and marked after 64 places.

Why do programmers use hexadecimal instead of binary?

One hex digit is exactly four bits, so a byte is always two hex digits and a 32-bit value is eight. Hex is four times shorter than binary and still lines up with the bits, which decimal does not. That is why memory addresses, colours and byte dumps are written in hex.

How many bits does a number need?

As many as its highest power of 2, plus one. 255 is under 2^8, so it needs 8 bits; 256 needs 9. In general it is floor(log2 n) + 1 for a positive n. A signed number needs one more bit for the sign in two's complement: 8 bits hold -128 to 127.

What is base 36 used for?

Base 36 uses all ten digits and all 26 letters, so it writes numbers in the fewest characters without symbols. Short codes and IDs in links often use it: 2026 is 1KA in base 36. Choose 36 in the To base list to try it.

Open the binary converter

Free, no sign-up, and what you enter stays in your own browser.