Number Base Converter

In short: 255 = 11111111 in binary, 377 in octal, FF in hex. This converter uses BigInt arithmetic, so unlike most it stays exact for numbers too big for a float — try DEADBEEF or a full 64-bit value.

Why bases exist, and why exactness is the whole game

A base is just a decision about how many symbols you count with before carrying. Humans settled on ten, probably because of fingers; computers settle on two because a switch has two states, and programmers then group those bits into eights (octal, historically) and sixteens (hexadecimal), because one hex digit is exactly four bits and converts by inspection. Converting between bases is trivial arithmetic: read the digits as a sum of digit-times-base-to-the-power, then divide repeatedly by the target base collecting remainders. The catch is entirely in the reading step. JavaScript numbers, and therefore most quick online converters, hold integers exactly only up to 2^53; feed one a 19-digit account number or a 256-bit value and it rounds the input before converting, returning plausible-looking hex that is wrong at the end. This tool parses the input string digit by digit into a BigInt, so the value converted is the value you typed, at any length.

Two habits make base work painless in practice. First, convert through grouped digits, not through decimal, when moving between binary, octal and hex: binary 11111111 groups as 11 111 111 (octal 377) or 1111 1111 (hex FF) with no arithmetic at all. Second, remember the landmarks: powers of two (256, 65,536, 4,294,967,296) and one-less values (255, 65,535) recur constantly, and recognising FF as "a full byte of ones" is faster than any tool. For negative values, this page shows sign-and-magnitude; real hardware uses two's complement at a fixed width, explained in the questions below.

Worked examples

255 decimal → binary 11111111 · octal 377 · hex FF.

DEADBEEF hex → decimal 3,735,928,559 · binary 11011110101011011011111011101111. A float-based converter cannot even hold this value's neighbours apart reliably once you pass 2^53; BigInt holds it exactly.

11111111 binary → decimal 255: eight ones, 128+64+32+16+8+4+2+1.

Where you already meet these bases every day

Hexadecimal is the one you will actually use. Web colours are three hex bytes: #FF8000 is red 255, green 128, blue 0. A MAC address is six hex bytes separated by colons; an IPv6 address is hex in groups of four digits; a Unicode code point is written in hex (U+1F600 is the grinning face emoji); memory addresses and error codes in crash logs are hex because a 64-bit address is a manageable 16 hex digits against 20 decimal ones. Binary shows up in file permissions' cousin, the Unix mode bits (where the same truth is written in octal: chmod 755 is rwxr-xr-x because 7 is 111, read-write-execute), in subnet masks (255.255.255.0 is twenty-four ones in a row, hence /24), and in bitmask flags throughout APIs, where each option owns one bit and the values combine by addition of powers of two. Learn to read FF, 80, and powers of two at sight and most of these notations stop being codes and become plain text.

Frequently asked questions

How do I convert 255 to binary and hex?

255 in binary is 11111111 and in hexadecimal is FF. The pattern is no coincidence: 255 is 2 to the power 8 minus 1, so it fills exactly eight binary digits with ones, and each hex digit holds four binary digits, so eight ones make two F's. This is why 255 appears everywhere in computing: it is the largest value in one byte, the maximum of an 8-bit colour channel, and the top of an IPv4 octet.

Why do other converters give wrong answers for very large numbers?

Most simple converters parse your input as a JavaScript number, which is a 64-bit float with only 53 bits of exact integer precision. Paste a 20-digit decimal and it is rounded before conversion even starts, so the hex result is wrong in its last digits without any warning. This converter parses digit by digit into a BigInt, which is exact at any length, so a 64-bit value like DEADBEEF (3,735,928,559) or a 256-bit hash-sized integer converts perfectly in both directions.

What does 0x and 0b mean in code?

They are prefixes programming languages use to declare the base of a literal: 0x starts a hexadecimal number (0xFF is 255), 0b starts binary (0b11111111 is also 255), and a leading 0 traditionally means octal (0377 is 255 again). You will also meet 0o for octal in newer languages. The prefixes exist because the same digits mean different values in different bases: 10 is ten in decimal, two in binary, eight in octal and sixteen in hex.

How are negative numbers represented in binary?

Computers almost universally use two's complement: in a fixed width (say 8 bits), negative numbers are stored as 256 minus their absolute value, so minus 1 becomes 11111111 (255 unsigned) and minus 128 is 10000000. The beauty is that addition works identically for signed and unsigned values. This converter shows the mathematical sign-and-magnitude form (a minus sign on the converted digits), because a base conversion without a stated bit width has no single two's complement answer; tell it the width and the rule above gives it.

What is DEADBEEF?

A hexadecimal value (3,735,928,559 in decimal) beloved of programmers because it spells an English word using only hex letters A to F. It belongs to a family of magic debug values including CAFEBABE, DEADC0DE and BADDCAFE, used as unmistakable markers in memory dumps and file formats: if you see one in a hex editor, you are looking at a deliberate signature, not data. Converting it here is a good exactness test: any converter that returns ...558 or ...560 is rounding.

Note: integers only (fractional values in non-decimal bases need a different treatment), shown in sign-and-magnitude form; two's complement depends on bit width. Everything runs locally in your browser.

Related tools

Conversion logic and worked examples last verified: 23 November 2026. Everything is calculated in your browser — nothing you type is sent anywhere.