Base converter

0x, 0b and 0o prefixes, grouping separators, and a leading minus are all understood.

Try one
Decimal input
8 bits

Decimal value

255

Binary1111 1111
Octal377
Decimal255
Hexadecimalff
Base 3673
Bit length8 bits
Digit count3
SignPositive
Even or oddOdd
Two’s complement (32-bit)
Fits in8 bits
Base in10
Decimal255
Hexff
Bits8

Number Base Converter

Convert exact integers between any bases from 2 to 36. Read binary, octal, decimal, and hexadecimal together, keep familiar prefixes and digit grouping, and inspect bit length or fixed-width two's-complement form.

Supported bases
2–36
Digit alphabet
0–9 · a–z
Exact integer range
64-bit+
Signed representation
2's

Step by step

How to use it

  1. 01

    01Choose the source base

    Pick a common base or set any radix from 2 through 36.

  2. 02

    02Enter the digits

    Spaces, commas, underscores, signs, and matching 0b, 0o, or 0x prefixes are accepted for practical pasted values.

  3. 03

    03Read every common form

    Binary, octal, decimal, hexadecimal, and the custom-base result update from the same exact integer.

  4. 04

    04Check the machine view

    Choose 8, 16, 32, or 64 bits to see whether a signed value fits and how its two's-complement bits look.

Worked example

Why FF means 255

Given

Input
FF
Source base
16

Place values

F × 16¹ + F × 16⁰
15 × 16  + 15 × 1
240      + 15
= 255
Decimal
255
Binary
1111 1111
Octal
377

A numeral is a sequence of digit values weighted by powers of its base. The integer stays the same; only its written representation changes.

Why this one

The value stays still while the notation changes

A base sets the available digits

Base 2 uses 0–1, base 16 uses 0–9 and A–F, and base 36 continues through Z.

Position supplies the power

Moving one place left multiplies a digit's weight by the base, exactly as decimal columns multiply by ten.

Grouping is visual only

Spaces and underscores make long numerals readable without changing their value.

Negative machine integers need a width

Two's complement depends on whether the register has 8, 16, 32, or 64 bits; the minus sign alone does not specify the bit pattern.

The judgement call

Which base belongs in the output?

  • Flags, masks, and bit operations

    Binary

    Each written digit maps to one bit.

  • Compact machine values and colors

    Hexadecimal

    One hex digit maps cleanly to four bits.

  • Unix permissions

    Octal

    Each digit represents three permission bits.

  • A value for a general reader

    Decimal

    It is the familiar everyday notation.

Reference

The numbers behind it

Binary prefix
0b
Octal prefix
0o
Hex prefix
0x
Signed n-bit range
−2ⁿ⁻¹ to 2ⁿ⁻¹ − 1

FAQ

Questions, answered plainly

How do I convert binary to decimal?

Multiply each bit by its power of two and add the results. The rightmost bit has weight 1, then 2, 4, 8, and so on.

What digits can base 36 use?

It uses 0–9 for values zero through nine and A–Z for values ten through thirty-five.

Can I convert numbers larger than JavaScript's safe integer limit?

Yes. Conversion uses arbitrary-precision integers, so large whole numbers do not lose low-order digits.

What is two's complement?

Two's complement is the standard fixed-width encoding for signed binary integers. A negative value is represented by adding it to 2 raised to the chosen width.

Do spaces or underscores change the number?

No. They are accepted as grouping separators and removed before parsing.

The numeral is parsed and converted entirely in your browser.