Are the numbers I type sent to a server?
No. The conversion is done entirely by JavaScript in your browser; the page has no backend, and what you type never leaves your device. Once the page has loaded you can go offline and it keeps working.
Type a number into any of the binary, octal, decimal or hexadecimal fields and the others are converted at once; the last field takes any other base from 2 to 36. Fractions, negative numbers and integers of any length are supported, and negative numbers can be viewed as two's complement in 8, 16, 32 or 64 bits. Everything is calculated in your browser, nothing is uploaded.
1111 0000, 1_000_000) and keep a prefix: the binary field accepts 0b, the octal field 0o, and the hexadecimal field 0x. Letters are not case-sensitive.0.625, 1010.01. Some fractions repeat forever in another base; they are cut at 32 fractional digits and the cut is marked with … at the end.a is 10, f is 15, z is 35, which is why base 36 is the highest.Decimal is how people count every day, carrying at ten. Binary has only 0 and 1 and is how a computer represents all data internally; bitwise operations, permission masks and subnetting all deal with it directly. Hexadecimal is shorthand for binary: every 4 bits correspond to exactly one hex digit, which is why memory addresses, colour values (#16B777), MAC addresses and hashes of every kind are written in hex. Octal maps each digit to 3 bits and survives mainly in Unix file permissions: in chmod 755 the 755 is octal.
To convert any base to decimal, expand by place value: from right to left, multiply each digit by the base to the power 0, 1, 2 and so on, then add the results. Binary 1011 is 1×8 + 0×4 + 1×2 + 1×1 = 11, and hexadecimal FF is 15×16 + 15 = 255. To go from decimal to another base, divide repeatedly by the target base and read the remainders in reverse. For 13 to binary, dividing by 2 gives the remainders 1, 0, 1, 1, which read backwards are 1101. Between binary and hexadecimal there is no need to pass through decimal: split the binary digits into groups of four from the right and replace each group with one hex digit: 1111 0000 is exactly F0.
Whether a fraction can be written with a finite number of digits in a given base depends on whether its denominator contains only prime factors of that base. Decimal 0.5, 0.25 and 0.625 have powers of 2 as denominators, so in binary they are the finite 0.1, 0.01, 0.101. But the denominator of 0.1 has a factor of 5, and in binary it becomes 0.000110011001100… repeating forever. This is why, in many programming languages, 0.1 + 0.2 does not equal 0.3: a floating-point number keeps only the first 53 bits of that repeating fraction, so what is stored is no longer exactly 0.1.
A computer does not store a minus sign; it represents negative numbers in two's complement: within a fixed width, a negative number is 2 to the power of the width minus its magnitude. In 8 bits −1 is 1111 1111 (hex FF), and −128 is 1000 0000. A top bit of 1 means the number is negative, so an 8-bit signed integer ranges from −128 to 127 and a 32-bit one from −2147483648 to 2147483647. The same bits give different results read as unsigned and as signed: hexadecimal FFFFFFFF is 4294967295 unsigned and −1 as a signed 32-bit integer. A huge positive number seen while debugging is often a negative one read the wrong way.
| Decimal | Binary | Octal | Hexadecimal |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 |
| 2 | 10 | 2 | 2 |
| 3 | 11 | 3 | 3 |
| 4 | 100 | 4 | 4 |
| 5 | 101 | 5 | 5 |
| 6 | 110 | 6 | 6 |
| 7 | 111 | 7 | 7 |
| 8 | 1000 | 10 | 8 |
| 9 | 1001 | 11 | 9 |
| 10 | 1010 | 12 | A |
| 11 | 1011 | 13 | B |
| 12 | 1100 | 14 | C |
| 13 | 1101 | 15 | D |
| 14 | 1110 | 16 | E |
| 15 | 1111 | 17 | F |
| 16 | 1 0000 | 20 | 10 |
| 32 | 10 0000 | 40 | 20 |
| 64 | 100 0000 | 100 | 40 |
| 100 | 110 0100 | 144 | 64 |
| 127 | 111 1111 | 177 | 7F |
| 128 | 1000 0000 | 200 | 80 |
| 255 | 1111 1111 | 377 | FF |
| 256 | 1 0000 0000 | 400 | 100 |
| 1024 | 100 0000 0000 | 2000 | 400 |
| 65535 | 1111 1111 1111 1111 | 177777 | FFFF |
The number 1024 keeps turning up in storage sizes because it is 2 to the power 10, a round number in binary. Whether KB, MB and GB step by 1024 or by 1000 is something you can work out under Data storage in the unit converter.
No. The conversion is done entirely by JavaScript in your browser; the page has no backend, and what you type never leaves your device. Once the page has loaded you can go offline and it keeps working.
Starting from the rightmost digit, the places stand for 1, 2, 4, 8, 16 and so on; add up the values of the places that hold a 1. Take 101101: its 1 digits stand for 32, 8, 4 and 1, which add up to 45. Type it into the binary field on this page and the decimal field gives the answer directly.
Keep dividing the number by 2 and note each remainder until the quotient reaches 0, then write the remainders from last to first. For 45 the remainders are 1, 0, 1, 1, 0, 1, which reversed give 101101. Another way is to build the number from powers of 2: 45 = 32 + 8 + 4 + 1, so write 1 in those places and 0 in the rest.
Hexadecimal FF equals 255 in decimal and in binary is 1111 1111, exactly the largest value one byte can hold. That is why each channel of an RGB colour runs from 00 to FF, that is 0 to 255. FFFF is 65535, FFFFFFFF is 4294967295.
They are how programming languages mark the base of a number: 0x starts a hexadecimal number, 0b starts a binary one, 0o starts an octal one, for example 0xFF, 0b1010, 0o755. In C, a number with a leading 0 (0755) is octal too. Paste a number with its prefix into the matching field and the prefix is ignored.
Because in binary, decimal 0.1 is the repeating fraction 0.0001100110011…, which never ends. This page keeps at most 32 fractional digits and marks the cut with an ellipsis. Fractions whose denominator is a power of 2, such as 0.5, 0.25 and 0.375, convert exactly and show no ellipsis.
Type a negative number such as −5 into the decimal field and the fields show a minus sign followed by the magnitude, like -101 with the two's complement given underneath: in 8 bits it is 1111 1011. To work it out, invert every bit of the magnitude and add 1. In the other direction, type FB into the hexadecimal field with the width set to 8, and the line underneath tells you that it reads as −5 when signed.
Integers have no upper limit. The conversion uses arbitrary-precision integers and never goes through floating point, so 64-bit integers, 128-bit UUIDs and 256-bit hashes all convert exactly, every digit correct. An ordinary calculator, and many online tools, lose the trailing digits once a number exceeds 253 (about 9 × 1015).
Base 36 uses all 10 digits and all 26 letters, the most compact notation that ignores case, and is often used to shrink a long numeric ID into a short string, as in short links and order numbers. In base 32 each digit corresponds to exactly 5 bits, which makes conversion easy. Pick the base in the last field to see the same number written in these bases.