Skip to content

Number Base Converter

Binary, octal, decimal, hex and any base 2–36, with steps. Runs in your browser.

Loading tool…

About this number base converter

This number base converter turns a number from any base between 2 and 36 into binary, octal, decimal, hex and one more base of your choice, all at once. It is for students checking homework, developers reading hex dumps, and anyone who needs to know what -42 looks like as a 16-bit pattern.

Type or paste the number and the results update as you type. Prefixes from code like 0x, 0b and 0o are understood, and separators such as spaces, underscores and commas are ignored, so 0xFF_FF or 1,048,576 work straight away. Every row has its own Copy button.

It also shows the working. You get the positional expansion, the repeated division table and the fraction multiplication table for any target base, plus a two's complement view for 8, 16, 32 and 64 bits. Big numbers stay exact, and nothing you type leaves your browser.

Features

  • Any base from 2 to 36

    Binary, octal, decimal and hex are always shown. Pick one extra output base, such as base 3 or base 36, and pick any input base from the Other menu. Bases above 10 use the letters A to Z as digits.

  • Exact big numbers

    All math uses BigInt, so a 30-digit decimal or 2^64 converts without rounding. The stats show how many bits and bytes the number needs and how many 1 bits it has.

  • Fractions with repeating digits

    Type 0.1 and you see binary 0.0(0011): the digits in brackets repeat forever. Results that neither end nor repeat within your digit limit (4 to 128 digits) end with an ellipsis, so you always know when a value was cut.

  • Two's complement view

    Choose 8, 16, 32 or 64 bits to see the bit pattern with the sign bit highlighted, the hex bits, and the value read as signed and unsigned. Negative numbers come with the flip-the-bits-and-add-one steps.

  • Step-by-step working

    Pick any target base and the tool lays out each step: digit times base to the power of its position, then division with remainders, then multiplication for the fraction part. Long numbers show the first 48 rows.

  • Readable output

    Group digits in fours for binary and hex or threes for octal and decimal, with a space, underscore or comma between groups. Switch letters to lowercase or add 0b, 0o and 0x prefixes when you paste into code.

How to use the number base converter

  1. 1Type a number and pick its base. Prefixes like 0x and 0b are detected.
  2. 2Read it in binary, octal, decimal, hex and any extra base you choose.
  3. 3Check the two's complement bits and the step-by-step working, then copy.

When to use it

  • Checking computer science homework

    Convert 156 to hex by hand, then compare each remainder with the division table here. The working matches the method most textbooks teach.

  • Reading registers and memory dumps

    Paste 0xDEADBEEF or a 64-bit address and read it in decimal and grouped binary. Use the two's complement card to see whether 0xFFFFFFD6 is a large unsigned value or -42.

  • Decoding hex colors and file permissions

    Turn the FF, 88 and 00 in #FF8800 into 255, 136 and 0, or read the octal mode 755 as binary 111 101 101 (rwxr-xr-x). For full color work, convert hex colors to RGB, HSL and more.

How do you convert decimal to binary?

Divide the number by 2 and write down the remainder. Keep dividing the quotient by 2 until it reaches 0, then read the remainders from the last one to the first. For 13 you get remainders 1, 0, 1, 1, so 13 is 1101 in binary. The same method works for any base: divide by 16 for hex, by 8 for octal.

Going the other way, multiply each digit by the base raised to its position, counting from 0 on the right, and add the results. Hex 1A is 1 × 16 + 10 × 1 = 26.

Hex and octal are popular because they map neatly onto bits. One hex digit is exactly 4 bits (a nibble) and one octal digit is exactly 3 bits, so 0xFF is 1111 1111 and octal 7 is 111.

Why does 0.1 never end in binary?

A fraction ends in a base only when its denominator breaks down into prime factors of that base. 0.1 is 1/10, and 10 has the factor 5, which 2 does not share. So 0.1 in binary is 0.0001100110011… with 0011 repeating forever, written here as 0.0(0011).

This is the reason 0.1 + 0.2 is not exactly 0.3 in most programming languages. IEEE 754 double precision stores 52 fraction bits and has to cut the repeating pattern somewhere.

What is two's complement?

Two's complement is how almost every modern CPU stores signed whole numbers. In an n-bit value the top bit counts as minus 2^(n-1) instead of plus, so 8 bits hold -128 to 127, 16 bits hold -32,768 to 32,767, and 32 bits hold -2,147,483,648 to 2,147,483,647.

To write a negative number, take its positive value in binary, flip every bit and add 1. For -42 in 8 bits: 0010 1010 becomes 1101 0101, and adding 1 gives 1101 0110, which is 0xD6. Read as unsigned, the same bits are 214. That is why the card shows both readings side by side.

  • 8-bit: -128 to 127 signed, 0 to 255 unsigned
  • 16-bit: -32,768 to 32,767 signed, 0 to 65,535 unsigned
  • 32-bit: -2,147,483,648 to 2,147,483,647 signed, 0 to 4,294,967,295 unsigned
  • 64-bit: -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 signed

Why use Mavros

 MavrosTypical upload sites
BasesAny base 2 to 36, five shown at onceOften only binary, decimal and hex
Large numbersExact with BigInt, any lengthOften rounded past about 16 digits
FractionsSupported, repeating digits markedRejected or silently cut off
Two's complement8, 16, 32 and 64 bits with stepsUsually a separate tool, or missing
Working shownExpansion, division and fraction tables for any baseAnswer only, or decimal to binary only

Tips

  • Paste values straight from code. 0x, 0b and 0o switch the base for you, and a note tells you when that happened.
  • To read a hex pattern as a signed number, enter it in base 16 without a minus sign, then pick the bit width in the two's complement card.
  • Turn off digit grouping before copying if the target program does not accept spaces or underscores inside numbers.
  • Need Roman numerals instead? The Roman numeral converter handles 1 to 3,999,999 with step-by-step checks.
  • Converting a Unix timestamp you found in hex? Get the decimal here, then turn it into a readable date.

Questions

How do I convert binary or hex to decimal?

Multiply each digit by the base raised to its position, counting from 0 on the right, and add the results. Binary 1011 is 8 + 0 + 2 + 1 = 11, and hex 2F is 2 × 16 + 15 = 47. Pick the input base and read the decimal row.

What is the largest number this converter can handle?

There is no fixed limit for whole numbers, because the math uses BigInt instead of floating point. A 100-digit decimal converts exactly. Very long inputs only shorten the step tables, which show the first 48 rows.

Can it convert negative numbers?

Yes. A leading minus sign is kept in every base, so -255 is -FF in hex. For the stored bit pattern of a negative number, use the two's complement card and pick 8, 16, 32 or 64 bits.

What do the brackets in a fraction result mean?

The digits inside the brackets repeat forever. 0.0(0011) means 0.0001100110011 and so on. If no repeat is found within your digit limit, the result ends with an ellipsis instead, which means it was cut.

How do I find the two's complement of a number?

Write the positive value in the chosen number of bits, flip every bit, then add 1. Enter a negative decimal such as -42, pick a width, and the card shows all three steps and the final pattern.

Why does hex FF show as -1 in the two's complement card?

At 8 bits the pattern 1111 1111 means 255 unsigned and -1 signed. The top bit is the sign bit, so the signed reading is 255 minus 256. At 16 bits the same value 0x00FF is just 255, because its top bit is 0.

What digits does base 36 use?

Base 36 uses 0 to 9 and then A to Z, so Z is 35 and 10 in base 36 equals 36 in decimal. Letters can be typed in either case, and the Uppercase option controls how they are shown.

Is my input sent anywhere?

No. Every conversion runs in your browser with JavaScript, and nothing is uploaded or stored. You can use it offline once the page has loaded. For other quick conversions, browse the converter tools.