Skip to main content

Binary to Decimal Calculator

Programming

Every base, one conversion.

Programming

Binary to Decimal Calculator

Convert between binary, octal, decimal, and hexadecimal at the same time, without losing leading bits.

Spaces and underscores are ignored. A 0b, 0o, or 0x prefix is accepted and stripped.

Converted value

255

Decimal value

Decimal
255
Binary
11111111
Octal
377
Hexadecimal
ff

Embed this calculator

Put this calculator on your own site with the snippet below. The frame contains the tool only, reports its own height, and carries a visible link back to the full page. Embedding is free; keep the attribution link as it is, and do not wrap the frame in a way that hides it.

Preparing the embed code for this page...

What This Calculator Does

The Binary to Decimal Calculator converts a number between base 2, 8, 10, and 16 at once. Choose the base you are typing in and it returns the same value in the other three, which is exactly what you need when reading a bitmask, a file header, or a memory address.

How It Works

A positional number system weights each digit by a power of its base. Parsing sums those weighted digits; formatting repeatedly divides by the target base to produce digits. Binary groups into four bits per hex digit, which is why hexadecimal is a compact way to write byte values.

Example

The binary value 11111111 is 255 in decimal, 377 in octal, and ff in hexadecimal — one byte with every bit set. Adding a 0b or 0x prefix is accepted and stripped, and spaces are ignored so you can paste grouped bits.

Formula

Positional value
Value = Σ digitᵢ × baseⁱ

The rightmost digit has index 0.

Binary to hex
Group bits in fours from the right; each group is one hex digit

Reading the Results

Decimal value

The value in base 10, which is the form most other calculations expect. Conversion is exact for integers within the safe integer range.

Hexadecimal

Four bits per digit, so one byte is always two hex digits. This is why memory dumps and colour codes use hex.

Sources and References

  • RFC 4648 — The Base16, Base32, and Base64 Data Encodings

    Base16 alphabet 0–9 and A–F

    Defines the hexadecimal digit set used for byte-oriented encodings.

  • IEEE 754-2019 — Standard for Floating-Point Arithmetic

    Bit-level representation of numbers

    Floating-point formats are specified in binary, which is why bit patterns are often read in hex.

References identify the method or data behind this calculator. Where a standard or tariff changes, the current edition applies, and the assumptions stated above take precedence over a remembered figure.

Frequently Asked Questions

How do I convert binary to decimal by hand?

Write the place values 1, 2, 4, 8, 16 and so on from right to left, then add the place values where the bit is 1. For 1011 that is 8 + 2 + 1 = 11.

Why does hexadecimal use letters?

Base 16 needs sixteen distinct digits, but only ten numeral symbols exist. The letters A to F stand for the values 10 to 15, so a byte fits in exactly two characters.

Does this handle negative numbers?

It converts the digits as an unsigned value. Negative numbers in computing are usually two’s complement bit patterns, which look like a large positive number when read unsigned. Interpret the result as a signed integer only if you know the bit width.

What is the largest value I can convert?

Anything up to 9,007,199,254,740,991, the largest integer JavaScript represents exactly. Larger values would silently lose precision, so the tool rejects them instead.