Developer tool

Binary Converter

Choose the input and output bases, enter an integer and convert it locally.

Runs in your browser. No upload.

Supports whole numbers in bases 2 through 36. Digits 0–9 and letters A–Z represent values.

Result
—

About this tool

Binary Converter made simple.

For a quick check, decimal 25 is binary 11001, octal 31 and hexadecimal 19. Convert signed whole numbers between any bases 2–36, including hexadecimal to binary; fractions and prefixes such as 0b or 0x are not accepted.

Guide

Using Binary Converter

This page turns a whole number written in one base into the same number written in another base. You pick any base from 2 to 36 for the input and for the output, type your number, and press the button. Binary, octal, decimal and hexadecimal are all in the lists, and so is everything in between. It suits students learning how number systems work, programmers checking a value, and anyone who needs a quick answer without opening code. The work happens in your browser, so nothing you type is sent away. It handles whole numbers only, with an optional minus or plus sign.

How to use it

  1. Open the From base list and choose the base your number is written in. Decimal is base 10, binary is base 2, and hexadecimal is base 16.
  2. Open the To base list and choose the base you want back. You can pick the same base twice, but that only repeats your number.
  3. Type your number into the box. Use only digits that exist in the base you chose, such as 0 and 1 for binary.
  4. Press Convert number. The answer appears in the Result line, written in capital letters when it contains letters.
  5. If you see an error, read the short message under the button. It names the base and tells you the digits were not valid for it.
  6. Press Clear to empty the box and the result, then start a new conversion.

Worked examples

Decimal 255 to binary

You enter
From
10
To
2
Number
255
You get
Result
11111111

255 is one less than 256, so all eight binary places hold a 1. That gives eight ones in a row.

Run through the tool’s own code.

Binary 11001 to decimal

You enter
From
2
To
10
Number
11001
You get
Result
25

The places are worth 16, 8, 4, 2 and 1. The ones sit on 16, 8 and 1, and 16 plus 8 plus 1 is 25.

Run through the tool’s own code.

Hexadecimal 1A3 to decimal and to binary

You enter
From
16
Number
1A3
To
10 or 2
You get
Decimal
419
Binary
110100011

In hex, A stands for ten. So 1A3 means 1 times 256, plus 10 times 16, plus 3, which is 419. Run it again with To base set to 2 for the binary form.

Run through the tool’s own code.

A negative number

You enter
From
10
To
2
Number
-42
You get
Result
-101010

The sign is kept and put in front of the converted digits. The tool does not use a two's complement form.

Run through the tool’s own code.

Base 36 uses every letter

You enter
From
36
To
10
Number
zz
You get
Result
1295

In base 36, z is worth 35. So zz is 35 times 36 plus 35, which is 1295. Lower case letters are accepted.

Run through the tool’s own code.

A space inside the number is rejected

You enter
From
2
To
10
Number
1010 1010
You get
Error
Use only valid digits for base 2.

Spaces are not valid digits, so a number grouped in bytes needs the spaces removed first.

Run through the tool’s own code.

When it helps

  • Check a homework answer when you are learning how binary and decimal relate to each other.
  • Turn a hexadecimal value from a colour code or memory address into decimal to see its size.
  • Read a Unix style octal permission such as 755 as a decimal number.
  • Build a short code in base 36 by converting a long decimal id into fewer characters.
  • Verify a value you worked out by hand before you put it in a program.
  • Compare the same number in several bases while preparing a computer science lesson.

Limits to keep in mind

  • Whole numbers only. A decimal point is rejected, so 3.5 gives an error.
  • Prefixes such as 0b or 0x are not accepted. Type only the digits.
  • Spaces between digits are not accepted. Underscores are removed before the conversion, so 1_000 works.
  • Input longer than 4,096 digits is refused. A leading plus or minus sign does not count towards the limit.
  • Negative numbers keep a minus sign. They are not shown as two's complement or with a fixed bit width.
  • The result is never padded with leading zeros, so you must add them yourself if you need 8 or 16 places.

Tips

  • To read a long binary number, split it into groups of four digits by hand. Each group matches one hex digit.
  • If you get an error, count the highest digit in your number. A 2 or higher cannot exist in binary, and a letter cannot exist in decimal.
  • Letters can be typed in either case. The answer always comes back in capitals.
  • Convert twice when you want to check yourself. Go from base 10 to base 2, then run the answer back to base 10.
  • Keep the signs you need. A leading plus is accepted and simply dropped from the answer.

UsefulVerse guides

All guides

Common questions

About Binary Converter.

How do I convert binary to decimal?

Set From base to 2 and To base to 10, type the ones and zeros without spaces, and press Convert number. The tool adds up the place values for you. For example, 11001 gives 25.

How do I convert hexadecimal to binary?

Choose 16 for the From base and 2 for the To base, then type the hex digits. Letters A to F stand for ten to fifteen. Leave out any 0x at the start, because prefixes are rejected.

Which bases can I choose?

Any whole base from 2 up to 36 can be used for the input and for the output. Digits 0 to 9 come first, and then letters A to Z carry on the count, up to Z for 35.

Why does it say I used digits that are not valid?

Each base has a limited set of digits. Binary only has 0 and 1, and octal stops at 7. If your number holds a character outside that set, a space, or a dot, the tool names the base and stops.

Can it convert numbers with a decimal point or fraction?

No. Only whole numbers are supported, so a value like 10.5 shows an error. If you need a fractional part, convert the whole part here and work out the fraction separately.

How big a number can I enter?

The number can have up to 4,096 digits, not counting a leading sign. The arithmetic uses big integers, so even very long numbers stay exact instead of being rounded the way ordinary floating point numbers are.

What happens with negative numbers?

A leading minus sign is kept, and the rest is converted as normal. So -42 in decimal becomes -101010 in binary. The tool does not produce a two's complement bit pattern.

Does the result have leading zeros?

No. The answer is the shortest correct form, so decimal 5 shows as 101, not 00000101. Add zeros yourself when a system needs a fixed width, such as eight bits to make one byte.

Can I paste a number with spaces or underscores?

Underscores are removed before converting, so 1_000 is read as 1000. Spaces are not removed, so remove them first or you will see the invalid digit message.

Is my number sent to a server?

No. The page works out the answer inside your browser. Nothing you type is uploaded, so you can use it for private values without leaving a trace on a server.

Which number bases are supported?

Convert signed whole numbers between any base from 2 to 36. Digits 0–9 and letters A–Z represent values; fractions are not supported.

What is 25 in binary?

Decimal 25 is 11001 in binary. Select Decimal as the input base and Binary as the output base, then enter 25.

Which number bases and values can I convert?

Convert signed whole numbers between any base from 2 to 36. Digits 0–9 and letters A–Z represent values; fractions and prefixes such as 0b or 0x are not accepted.