Binary Hex Decimal Converter
Convert between binary, octal, decimal, hex and any base 2–36 live, with two’s complement, fractions, text conversion and a full binary calculator. Exact BigInt math — 100% in your browser, nothing is uploaded.
Live converter — type in any field
Type a number in any box and the other four update instantly. Prefixes (0b, 0o, 0x), spaces, underscores and commas are accepted. A leading minus sign means a negative number. One decimal point is allowed for fractions.
Two’s complement
A negative number without a width has no single bit pattern — it is shown with a minus sign (for example −FF). With a width, the value is wrapped into that many bits. The signed reading always uses the width shown here.
Bit visualiser — click a bit to flip it
Bits below are the two’s complement pattern at the width above (up to 64 bits). Click any bit and every value on this page updates.
Step-by-step working (generated live from your number)
Binary calculator — add, subtract, multiply, divide & bitwise
Whole numbers only. Pick a base for each input, an operation and a word size. Results are shown in all four bases with signed and unsigned readings and overflow flags.
Step-by-step working for this calculation
Text ↔ binary / hex
Text is encoded as UTF-8: plain English letters are 1 byte each, accented letters take 2 bytes and emoji take 4 bytes. Decoding rejects invalid byte sequences instead of guessing.
Decode binary / hex / octal back to text
One-click examples
Conversion table 0–15
Powers of 2
ASCII table 0–127 (printable characters)
Conversion table 0–255
What is a binary, hex and decimal converter?
Computers store everything as bits — 0s and 1s. Binary (base 2) is the computer’s own language, decimal (base 10) is the one we use every day, hexadecimal (base 16) is the short way programmers write binary, and octal (base 8) still shows up in file permissions such as chmod 755. This converter translates a number between all of them instantly, in either direction, with exact math.
How to convert binary to decimal
Write the place values above the bits: 1, 2, 4, 8, 16, 32 and so on, doubling each time to the left. Add the place values where the bit is 1. For example, 1011 = 8 + 0 + 2 + 1 = 11. The step-by-step panel above does exactly this for your number.
How to convert decimal to binary or hex
Divide by the target base and keep the remainders. For binary, divide by 2 again and again: 13 ÷ 2 = 6 remainder 1, 6 ÷ 2 = 3 remainder 0, 3 ÷ 2 = 1 remainder 1, 1 ÷ 2 = 0 remainder 1 — read the remainders from the bottom up: 1101. For hex, divide by 16 the same way: 3000 = BB8 in hex.
Why two’s complement depends on the width
The same bit pattern can mean two different numbers. 11111111 is 255 as an unsigned byte, but −1 as an 8-bit signed number. And 1101 is −3 in 4 bits, but 00001101 is +13 in 8 bits — leading zeros change the signed reading, so this tool never strips them before computing it. Always check the width shown in the two’s complement panel.
Why 0.1 repeats forever in binary
A fraction ends in a base only when its denominator’s prime factors divide that base. 0.5 is 0.1 in binary and 0.625 is 0.101 — both exact. But 0.1 in decimal is 0.0001100110011… in binary, repeating forever, so the tool shows the digits you asked for and marks the value with “…” and the label “repeating / truncated” instead of pretending it is exact.
How big can the numbers be?
Ordinary JavaScript numbers lose precision above 2⁹³ − 1 = 9,007,199,254,740,991, so most converters go wrong past 53 bits. This page uses BigInt for every integer path, so values far beyond 64-bit convert exactly — 2⁶⁸ − 1 = 18,446,744,073,709,551,615 converts without error. Input is capped at 2,000 digits so the page stays fast; that cap is stated here, not hidden.
100% in your browser — nothing is uploaded
Every conversion, calculation and text encoding on this page runs locally in your browser with vanilla JavaScript. No server, no account, no signup, no upload. Your numbers and text never leave your device.
Frequently asked questions
1. How do I convert binary to decimal?
Add the place values of the 1 bits. Each bit is worth twice the one to its right: 1, 2, 4, 8, 16, 32 and so on. For example, 1011 = 8 + 0 + 2 + 1 = 11. Type the binary number above and the place-value table shows every step.
2. How do I convert decimal to binary or hex?
Use repeated division: divide by 2 (for binary) or 16 (for hex) and keep the remainders, then read them from the bottom up. 13 ÷ 2 gives remainders 1, 0, 1, 1, so 13 = 1101 in binary. 3000 ÷ 16 gives BB8 in hex. The step-by-step panel generates the full division table for your number.
3. How do I convert binary to hex?
Split the binary digits into groups of 4 starting from the right, then replace each group with one hex digit (0000 = 0, 1010 = A, 1111 = F). For example, 10110110 groups as 1011 0110, which is B6 in hex. The grouping diagram above shows this for your number; grouping in 3s works the same way for octal.
4. What is two’s complement, and why is 11111111 both −1 and 255?
Two’s complement is how computers store negative numbers in a fixed width. In 8 bits, 11111111 is 255 unsigned, but −1 signed, because −1 is stored as all 1s. The width decides the meaning: 1101 is −3 as a 4-bit signed number, but 00001101 is +13 as an 8-bit signed number. That is why this tool always labels the width it used and warns you when a value overflows it.
5. Can it convert fractions, and why does 0.1 repeat in binary?
Yes. Fractions such as 10.625 = 1010.101 in binary are exact, because their denominators are powers of 2. But 0.1 in decimal is 0.0001100110011… in binary, repeating forever, so no finite number of binary digits can hold it exactly. This tool shows up to 10, 20 or 50 fraction digits (your choice) and marks the result with “…” and “repeating / truncated” so a rounded value is never presented as exact.
6. How big a number can it convert?
Very big. Ordinary JavaScript numbers lose precision above 2⁹³ − 1 (9,007,199,254,740,991), but this tool uses BigInt, so integers far beyond 64-bit convert exactly — including 2⁶⁸ − 1 = 18,446,744,073,709,551,615. Input is capped at 2,000 digits per number so the page stays fast.
Free forever — no login, no signup. All conversions run in your browser.
Last updated: 20 November 2026
No comments:
Post a Comment