The same number wears different costumes depending on where you meet it. A permission is 755 in one place and a string of bits in another. A color is a hex code in a stylesheet and three decimal channel values in a design tool. A memory address arrives in hexadecimal and needs to be compared against a decimal figure in a log. Converting between binary, decimal and hexadecimal is the small, constant translation job underneath all of that.

This guide explains how the four bases relate, shows how to convert with the free Number Base Converter on Ovatly, and works the classic examples by hand so you can sanity-check any result the tool gives you.

Contents

  • Quick answer
  • The four bases in plain terms
  • How place value makes conversion work
  • How to convert a number, step by step
  • Worked example: 255 in every base
  • Converting a hex color
  • Limitations and honest notes
  • Common mistakes
  • FAQs
  • Conclusion

Quick answer

Type the number into the Number Base Converter, tell the tool which base the input is in, and read all four representations at once: binary, octal, decimal and hexadecimal. Copy the one you need, or copy all at once. The converter uses BigInt arithmetic, so integers convert exactly even past 2^53, where ordinary JavaScript numbers start losing precision. It accepts integers only, validates the digits against the base you chose, and treats a leading minus as a plain sign.

The four bases in plain terms

A base is a count of how many digit symbols a system has before it carries into the next place.

  • Binary (base 2) uses two digits, 0 and 1. It is the language of bits, flags and anything stored as on or off.
  • Octal (base 8) uses digits 0 to 7. It survives mainly in places like file permissions, where three bits group neatly into one octal digit.
  • Decimal (base 10) uses digits 0 to 9. It is the everyday system, and the one humans read most easily.
  • Hexadecimal (base 16) uses digits 0 to 9 plus the letters A to F, where A is 10 and F is 15. Four bits group neatly into one hex digit, which is why addresses and color values are written in it.

Programmers move between these bases for permissions, bitwise flags, memory addresses and color values, which is exactly the set of jobs this converter is built for.

How place value makes conversion work

Every base reads the same way: each position is worth the base raised to a power, counting from the right starting at zero. In decimal, 255 means 2 times 100, plus 5 times 10, plus 5 times 1. The same rule in binary makes 1010 easy to check by hand: the positions are worth 8, 4, 2 and 1, the digits pick out 8 and 2, and 8 plus 2 is 10. So binary 1010 is decimal 10, and since 10 is the first value hexadecimal needs a letter for, it is also hex A.

Hexadecimal works identically with sixteens. FF means 15 times 16, plus 15, which is 240 plus 15: 255. Once you trust the place-value rule, no conversion result should ever feel like magic, and a wrong digit in your input becomes easy to spot because the output stops matching your hand check.

How to convert a number, step by step

  1. Open the Number Base Converter.
  2. Type the number. A leading minus is allowed if the value is negative.
  3. Tell the tool which base the input is in.
  4. Read all four representations and copy the one you need, or copy all at once.

That is the whole workflow. The one step worth slowing down on is step 3: the same digits mean different values in different bases, so the input base has to be right before anything else can be.

Worked example: 255 in every base

Decimal 255 is the classic test value because it lands cleanly in every base:

  • Binary: 11111111 (eight ones: 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255)
  • Octal: 377 (3 times 64, plus 7 times 8, plus 7 = 192 + 56 + 7 = 255)
  • Hexadecimal: FF (15 times 16, plus 15 = 255)

Exactness matters more as numbers grow. The value 18446744073709551615, which is 2^64 minus 1, converts to hexadecimal FFFFFFFFFFFFFFFF precisely. A normal floating-point number cannot even represent that integer, which is why the converter parses digit by digit with BigInt instead of trusting ordinary arithmetic.

Converting a hex color

A hex color such as #2563EB is three base-16 numbers packed together. The tool's FAQ gives two ways to handle it: convert the whole value at once, entering 2563EB in base 16, to get the single decimal number, or convert each pair separately when you want the individual red, green and blue channel values. The pairs check out by hand: 25 is 2 times 16 plus 5, which is 37; 63 is 6 times 16 plus 3, which is 99; EB is 14 times 16 plus 11, which is 235. So the channels are red 37, green 99 and blue 235.

Limitations and honest notes

The converter handles integers only. Fractional values like 10.5 are not accepted in any base, so decimal fractions and their binary equivalents are out of scope.

Negative numbers carry a plain sign: a leading minus is shown in every base. Fixed-width two's complement representation is a different convention that depends on the bit width you choose, and this tool does not produce it.

Hexadecimal output uses upper-case letters for readability, while input accepts either case, so ff and FF are both fine to type. And because the conversion runs on your device with exact arithmetic, the practical limit is your patience with long digit strings, not precision.

Common mistakes

  • Declaring the wrong input base. The digits 1010 are worth 10 read as binary and 1,010 read as decimal. The digits do not change; the value follows the base you select, so always set the base before reading the result.
  • Typing digits the base does not have. A 2 cannot appear in binary. The converter rejects input like 102 as binary with a clear message instead of converting it wrongly, so treat that message as a prompt to check the base or the digits.
  • Expecting fractions to convert. Values like 10.5 are refused in every base. Convert the whole part and handle any fraction separately.
  • Reading the sign as two's complement. A minus sign in the output is just a sign. If you need a fixed-width two's complement pattern, that is a separate calculation the tool does not claim to do.
  • Trusting a general calculator for huge integers. Past 2^53, ordinary floating-point arithmetic silently rounds. A value that looks converted may have lost its last digits without any warning.

FAQs

Why use BigInt instead of a normal number? JavaScript numbers are exact for integers only up to 2^53. Past that, digits silently round. This converter parses digit by digit with BigInt, so a 64-bit value converts exactly.

How do I convert a hex color like #2563EB? Convert the whole value at once (2563EB in base 16) to get the decimal number, or convert each pair (25, 63, EB) separately if you want the individual red, green and blue channel values.

Does it handle two's complement negatives? No. A leading minus is a sign, shown in every base. Fixed-width two's complement representation is a different convention that depends on the bit width you choose.

Can I convert a fraction like 10.5? No. The converter accepts integers only, and fractional values like 10.5 are not accepted in any base.

What happens if I type a digit that does not belong to the base? The digits are validated against the chosen base, so 102 is rejected as binary with a clear message rather than converted wrongly.

Conclusion

Base conversion is place value plus patience, and the Number Base Converter removes the patience part: one input, four exact representations, with digit validation to catch the classic wrong-base slip. Keep the hand checks from this guide, 255 to FF and 1010 to 10, as your smoke test whenever a result looks surprising. When the text around the numbers changes instead of the numbers themselves, the companion guide on comparing two pieces of text covers that job, and both guides live in the Developer Tools guides archive.