Back to blog

Base ConversionBinaryHexadecimalDeveloper Tools

Base Converter Guide: Binary, Decimal, and Hex

Convert binary, decimal, hexadecimal, and bases 2–36 online. Follow worked examples for FF and 255, common prefixes, negative values, BigInt, and errors.

Base Converter Guide: Binary, Decimal, and Hex cover

Binary, decimal, and hexadecimal conversion means writing the same integer with different place values. Open the online integer base converter, choose the input base, and enter a value to see binary, octal, decimal, hexadecimal, and one custom-base result at once. We tested the source code's default example, ff: with base 16 selected, it returns decimal 255 and binary 11111111.

Base converter cover with binary digits and hex prism

This guide explains the result instead of treating the converter as a black box. The tool handles bases 2–36, negative values, common base prefixes, and very large integers. It currently converts integers only, not fractions.

How to convert binary, decimal, and hexadecimal

The reliable workflow is to identify the input base first and then convert the value:

  1. Open the Yaya Tools integer base converter.
  2. Set Source base to 2, 8, 10, 16, or any integer from 2 through 36.
  3. Enter a value, such as hexadecimal ff.
  4. Read the live results on the right.
  5. Use the Copy button beside the result you need.

Here is the complete ff example:

Representation Value Interpretation
Binary 11111111 All eight binary digits are 1
Octal 377 3×8² + 7×8¹ + 7×8⁰
Decimal 255 The ordinary base-10 integer
Hexadecimal ff Each f has the decimal value 15

All four strings represent the same integer. Base conversion changes the notation, not the value.

The place-value rule behind base conversion

An integer in any positional base is the sum of each digit multiplied by a power of that base. For hexadecimal ff, the value of f is 15:

text
ff₁₆ = 15 × 16¹ + 15 × 16⁰
     = 240 + 15
     = 255₁₀

To convert decimal 255 to binary by hand, repeatedly divide by 2 and read the remainders in reverse. You can also see 255 as the sum of the first eight binary place values:

text
255 = 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1
    = 11111111₂

One hexadecimal digit maps neatly to four binary digits. f maps to 1111, so ff maps to 11111111. That four-bit grouping is useful when checking colors, bytes, bit masks, or network addresses.

Why the converter supports bases 2 through 36

The converter uses 0–9 and a–z as digits, providing 36 distinct symbols. Hexadecimal needs only 0–9 and a–f; base 36 uses the full set.

The ECMAScript BigInt::toString specification likewise defines a radix from 2 through 36 and uses the ordered characters 0123456789abcdefghijklmnopqrstuvwxyz. The converter follows that convention and returns lowercase letters.

A custom-base example

Decimal 35 becomes z in base 36. Decimal 36 becomes 10. That 10 does not mean decimal ten; in base 36 it means one group of 36 plus zero ones.

How binary, octal, and hexadecimal prefixes work

When the selected source base matches, the converter removes three familiar prefixes automatically:

Prefix Base Example Decimal result
0b 2 0b1010 10
0o 8 0o17 15
zero followed by x 16 zero + x + ff 255

MDN's JavaScript number syntax guide also documents 0b, 0o, and 0x for binary, octal, and hexadecimal literals. In this converter, the source base must match the prefix. Select base 16 before entering 0xff.

Do not add a language suffix. JavaScript source code may write a BigInt literal as 255n, but this tool accepts numeral text. It treats n as a potential digit and rejects it in base 10 or 16.

Why large integer conversion stays exact

The page reads the input one digit at a time and accumulates it with the browser's BigInt type instead of first converting it to a floating-point Number. That design preserves integers beyond JavaScript's usual safe-integer range.

We checked decimal 9007199254740993. The converter returns hexadecimal 20000000000001; entering that result as base 16 restores the original decimal value. MDN defines BigInt as a JavaScript numeric type capable of representing integers with arbitrary precision. “Arbitrary precision” does not mean unlimited input: browser memory and page performance still impose practical limits.

If you are inspecting network addresses, pair the converter with the IPv4 subnet calculator guide to see how eight binary bits form each decimal octet. If your input looks like %20 or %2F inside a URL, use the URL encoder and decoder instead. Percent encoding represents bytes inside URL components; it is not a single positional integer.

Negative values, letter case, and invalid input

How are negative integers converted?

Put a minus sign before the digits. With source base 2, -1010 returns decimal -10 and hexadecimal -a.

The output is a minus sign followed by the positive magnitude in the target base. It is not a fixed-width two's-complement bit pattern. MDN's BigInt.toString() description makes the same distinction. To calculate 8-bit, 16-bit, or 32-bit two's complement, you must choose a bit width first.

Does letter case matter?

No. The converter normalizes input to lowercase, so hexadecimal FF and ff both return 255. Output letters are lowercase.

Why does the tool report an invalid integer?

A digit usually falls outside the selected source base:

  • Binary accepts only 0 and 1, so 102 is invalid.
  • Octal accepts only 0–7, so 89 is invalid.
  • Hexadecimal accepts only 0–9 and a–f, so fg is invalid.
  • Decimal points, embedded spaces, comma separators, and the BigInt suffix n are unsupported.

The page trims whitespace at the beginning and end, but it does not remove spaces between digits. Clean copied log or spreadsheet values before converting them. For a list of values that needs a total, use the number sum calculator; the base converter accepts one integer at a time.

Practical uses for an integer base converter

Debug colors and byte values

Hexadecimal commonly represents color channels and bytes. For example, ff is decimal 255 and eight-bit binary 11111111. When you need to sample HEX, RGB, or HSL directly from an image, the image color picker is faster than splitting a color string by hand.

Learn binary place values

Converting small values back and forth makes each binary place value visible. Calculate a result by hand first, then use the tool to check it. Blindly copying the output can hide a wrongly selected source base.

Check numeric IDs and short codes

Some systems encode numeric IDs in base 36 to shorten them. Confirm that the system documentation defines the string as a positional integer before converting it. A case-sensitive code, a hyphenated token, or a code with a custom alphabet may not be ordinary base 36.

Frequently asked questions

What is binary 11111111 in decimal?

It is decimal 255, hexadecimal ff, and octal 377. Select source base 2 and enter 11111111 to verify all three results.

Are hexadecimal FF and ff different?

No. They both represent decimal 255. The converter accepts either letter case and returns lowercase output.

Can the converter handle fractions?

No. The current version handles integers only and rejects an input such as 10.5. Fractional base conversion needs separate precision and rounding rules.

Can it convert several numbers at once?

No. The input accepts one integer, although the results show several target bases simultaneously.

Does the value leave my browser?

No. The page's JavaScript parses the digits, converts the integer, and renders the results locally in your browser.

References

On this page