Number converter · Free · No sign-up
Binary Converter
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.
- Divide 2026 by 2 again and again, writing down each remainder.
- 2026 ÷ 2 = 1013 remainder 0
- 1013 ÷ 2 = 506 remainder 1
- 506 ÷ 2 = 253 remainder 0
- 253 ÷ 2 = 126 remainder 1
- 126 ÷ 2 = 63 remainder 0
- 63 ÷ 2 = 31 remainder 1
- 31 ÷ 2 = 15 remainder 1
- 15 ÷ 2 = 7 remainder 1
- 7 ÷ 2 = 3 remainder 1
- 3 ÷ 2 = 1 remainder 1
- 1 ÷ 2 = 0 remainder 1
- Read the remainders from the last to the first: 11111101010.
| Form | Value |
|---|---|
| Binary (base 2) | 11111101010 |
| Octal (base 8) | 3752 |
| Decimal (base 10) | 2026 |
| Hexadecimal (base 16) | 7EA |
| Binary in groups of four | 111 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
| Detail | Answer |
|---|---|
| Bases | Any from 2 to 36 (digits 0 to 9, then A to Z) |
| Example | 2026 = 11111101010 in binary = 3752 octal = 7EA hex |
| Size | Up to 256 characters, exact (BigInt), so 64-bit and larger values are never rounded |
| Fractions | Exact; repeating digits in brackets, as in 0.1 = 0.0(0011) in binary |
| Signed numbers | Two's complement at 8, 16, 32 or 64 bits |
| Where your numbers are kept | This 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.
Type the number
Digits only, with an optional point and minus sign; 0x, 0b, 0o or # are read if they match.
Choose the base it is in
From base: 2 for binary, 8 octal, 10 decimal, 16 hex, or any up to 36.
Choose the base you want
To base: the big result; the table shows binary, octal, decimal and hex anyway.
Turn on two's complement if needed
Pick 8, 16, 32 or 64 bits to see a negative number as its bit pattern.
Read the working
Place values to decimal, then repeated division, and the grouping shortcut where it applies.
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.
| Entry | Floating-point converter | This converter |
|---|---|---|
| 9007199254740993 to binary | 1 followed by 53 zeros (that is 253, one too small) | 1, then 52 zeros, then 1 |
| 0.1 to binary | 0.0001100110011…1101 (55 places, then stops) | 0.0(0011): 0011 repeating for ever |
| 0.1 to hex | 0.1999999999999A | 0.1(9) |
| 264 − 1 to hex | 10000000000000000 (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.
| Base | Name | Digits | Where you meet it |
|---|---|---|---|
| 2 | Binary | 0 1 | Bits in memory, logic circuits, network masks (255.255.255.0 is 24 ones) |
| 8 | Octal | 0 to 7 | Unix file permissions: chmod 755 is 111 101 101, read-write-run for the owner |
| 10 | Decimal | 0 to 9 | Everyday counting |
| 16 | Hexadecimal | 0 to 9, A to F | Bytes (00 to FF), colour codes, memory addresses, Unicode code points such as U+00E9 |
| 36 | Base 36 | 0 to 9, A to Z | Short 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.
| Width | Lowest | Highest | −1 as a pattern (hex) |
|---|---|---|---|
| 8-bit | −128 | 127 | FF |
| 16-bit | −32,768 | 32,767 | FFFF |
| 32-bit | −2,147,483,648 | 2,147,483,647 | FFFFFFFF |
| 64-bit | −9,223,372,036,854,775,808 | 9,223,372,036,854,775,807 | FFFFFFFFFFFFFFFF |
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.
| Bits | Hex digit | Decimal | Octal |
|---|---|---|---|
| 0000 | 0 | 0 | 0 |
| 0001 | 1 | 1 | 1 |
| 0010 | 2 | 2 | 2 |
| 0011 | 3 | 3 | 3 |
| 0100 | 4 | 4 | 4 |
| 0101 | 5 | 5 | 5 |
| 0110 | 6 | 6 | 6 |
| 0111 | 7 | 7 | 7 |
| 1000 | 8 | 8 | 10 |
| 1001 | 9 | 9 | 11 |
| 1010 | A | 10 | 12 |
| 1011 | B | 11 | 13 |
| 1100 | C | 12 | 14 |
| 1101 | D | 13 | 15 |
| 1110 | E | 14 | 16 |
| 1111 | F | 15 | 17 |
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.
| It does | It does not |
|---|---|
| Any base from 2 to 36, both ways | Bases above 36, such as base 64 or base 60 |
| Exact whole numbers of any length and exact fractions | Round through floating point |
| Two’s complement at 8, 16, 32 and 64 bits | Encode IEEE 754 floats |
| Show the working | Send your numbers anywhere |
This converter or a typical one
| This page | A typical one | |
|---|---|---|
| Bases | Any from 2 to 36 | Often 2, 8, 10 and 16 only |
| Numbers past 253 | Exact | Often rounded silently |
| Fractions | Exact, repeats marked | Rounded or refused |
| Two's complement | 8 to 64 bits, explained step by step | A result without the steps |
| Working shown | Every step, numbered | Sometimes |
| Your numbers leave the browser | Never | Varies |
More converters
Every converter on the site runs in your browser, needs no sign-up, and sends nothing anywhere.
Numbers & code6
Binary, hex, octal and any base, number systems, and codes generated in the browser.
Binary to decimal
Each bit times its power of 2, binary fractions after the point, and signed patterns read at 8 to 64 bits.
Open binary to decimal →Decimal to binary
Repeated division by 2 shown step by step, 0.1 as the repeating 0.0(0011), negatives in two's complement.
Open decimal to binary →Decimal to hex
Division by 16 with A to F named, RGB channels to a #RRGGBB code, and negatives as hex patterns.
Open decimal to hex →Hex to decimal
Powers of 16 shown, #RGB to #RRGGBBAA colour codes read as channels, signed bytes and 0x addresses.
Open hex to decimal →Password generator
Random characters or EFF-word passphrases from the browser's crypto, no modulo bias, exact entropy, nothing sent.
Open password generator →ASCII, hex, binary, decimal converter
Text and byte codes both ways in one box, UTF-8 beyond 127 shown byte by byte, control characters named, Base64.
Open ascii, hex, binary, decimal converter →
All 31 converters, by category: Length (10) · Weight & mass (5) · Temperature (3) · Cooking (1) · Currency (1) · Numbers & code (7) · Text (2) · Images (1) · Dates & time (1)
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.
Related guides
Longer answers to the questions behind the numbers.
- Tallying
Tally marks explained
Groups of five, the five-bar gate, and why the convention has survived for centuries.
- Counting
Count to 1,023 on your fingers
The value of each of ten fingers, worked examples, how to count up, and why the top is 1,023.
- Reference
Types of counters explained
Synchronous vs asynchronous, mod-N, ring and Johnson, industrial and PLC counters, plus mechanical and software counters.
- Tallying
Tally marks in Excel and Google Sheets
The REPT, INT and MOD formula for five-bar gates, tested on every count from 0 to 120; a tally chart from raw answers with COUNTIF; and why LEN miscounts typed tallies.
- Counting
Why word counts differ between tools
The same sentence is 26 words to one counter and 39 to another. Four counting rules side by side, and how to meet a hard limit whichever one a form uses.