Convert numbers between binary, decimal, hexadecimal, octal, and more bases.
The Number Base Converter converts a number between binary, octal, decimal, hexadecimal, and other custom bases, updating every representation at once. It's free, runs entirely in your browser, and is a practical reference for programmers and students working with different number systems.
Made for everyone. Typical uses:
The decimal number 255 is 1111 1111 in binary, 377 in octal, FF in hexadecimal and 73 in base 36. The octal permission 755 is 493 in decimal, 111 101 101 in binary and 1ED in hexadecimal.
It converts whole numbers only; fractions are not supported. Negative numbers keep a minus sign (-42 is -101010 in binary) and are not shown in two's complement, the form used inside computers.
Accuracy: Conversions use well-known methods and are tested with real sample inputs. Check the output before you send or publish it.
Expert Tip
For an 8-bit two's complement value, convert 256 minus the number: -42 becomes 214, which is 11010110 in binary.
The Number Base Converter turns a whole number from one base into the others at once. You type a number, choose its input base from 2 to 36, and the tool shows the binary, octal, decimal and hexadecimal forms together with one extra base of your choice. Digits can be grouped for readability, and every row has a copy button. Spaces, commas and underscores in the input are ignored, letters can be upper or lower case, and the prefixes 0x, 0b and 0o are accepted when they match the base you selected.
These results come from the same functions the tool uses.
Each digit in a number is worth the base raised to its position. In hexadecimal, FF means 15 × 16 + 15 = 255. Going the other way, you divide repeatedly by the target base and read the remainders upward. Binary and hexadecimal fit together neatly, because one hex digit is exactly four binary digits: F is 1111, so FF is 1111 1111. Octal groups bits in threes, which is why a Unix permission such as 755 is easy to read as 111 101 101 and equals 493 in decimal, or 1ED in hexadecimal.
Hexadecimal appears in colour codes, memory addresses, byte values and hashes. Octal is the notation of Unix file permissions. Binary is used for flags and bit masks, and base 36, which uses all ten digits and all 26 letters, is a compact way to write short identifiers. A colour such as #3b82f6 is three hex bytes, 59, 130 and 246 in decimal, and you can see the colour itself in the Color Converter. For text rather than numbers, the Hex to Text Converter and the Base64 Encoder / Decoder work on the characters themselves.
The tool uses arbitrary-precision integers, so very large values convert exactly. The largest unsigned 64-bit number, 18446744073709551615, becomes FFFFFFFFFFFFFFFF in hexadecimal and a 64-digit binary string. Negative numbers are handled with a minus sign, so -42 is -101010 in binary, -52 in octal and -2A in hexadecimal. That is the signed magnitude, not the two's complement form used inside computers. To get two's complement for 8 bits, convert 256 - 42 = 214 instead, which is 11010110.
If a character is not valid in the base you chose, the tool names it: typing 12 with binary selected returns the message that "2" is not a valid digit in base 2. Fractions are not supported, so a decimal point is rejected. For quick conversions between only binary and decimal, the Binary Decimal Converter is a more focused tool, and the Roman Numeral Converter handles another number system altogether.
Explore more in Converters, read the guides and articles, or see how we test our tools.
Convert binary numbers to decimal and vice versa.
Best for checking a computer science homework answer on binary-to-decimal conversion
Convert numbers to Roman numerals and vice versa.
Best for decoding the Roman numeral copyright year shown at the end of a movie or TV show
Convert hexadecimal values to readable text and vice versa.
Best for decoding a hex-dumped string found in a browser dev tools network request
Convert colors between HEX, RGB, HSL, CMYK, and more formats.
Best for converting a HEX color from a design file into RGB for code or a library
Encode and decode Base64 strings instantly.
Best for encoding binary data for email and web transmission