1. Home
  2. Developer
  3. Number Base Converter

Number Base Converter

Convert numbers between binary, octal, decimal and hexadecimal.

Runs in your browser · No upload Works offline
0x, 0b and 0o prefixes are fine, as are underscores, spaces or commas between digits.
Results
Results
BaseValue
Binary (2)1111 1111
Octal (8)377
Decimal (10)255
Hex (16)FF
Base 3673
Bits needed
8
Decimal digits
3

Two's complement (fixed-width integer)

Bit pattern
1111 1111
Hex
0xFF
Read as unsigned
255
Read as signed (two's complement)
-1

Calculations run in your browser with exact BigInt arithmetic; nothing is uploaded.

How to use

  1. Enter a number and choose which base it’s written in. Prefixes like 0x1F, 0b1010 or 0o17 are recognized automatically.
  2. Binary, octal, decimal and hex results appear in a table; each row has its own Copy button. Add any other base, such as 3 or 36, under “Extra base to show”.
  3. In the Two’s complement section, see the bit pattern an 8-, 16-, 32- or 64-bit integer would store, and what that pattern means read as unsigned or signed.

How base conversion works

Each digit in base N stands for a power of N. To get decimal, multiply each digit by its place value and add; to go from decimal, divide by N repeatedly and read the remainders backwards.

Decimal Binary Octal Hex
10 1010 12 A
255 1111 1111 377 FF
256 1 0000 0000 400 100
65,535 1111 1111 1111 1111 177777 FFFF

Example: hex 1F = 1×16 + 15 = 31. Four binary digits map exactly to one hex digit and three to one octal digit, which is why programmers abbreviate long binary values in hex. Base 36 uses 0–9 plus a–z as digits.

What is two’s complement?

Most computers store negative integers in two’s complement: in N bits, −x is stored as the bit pattern of 2ᴺ − x. So the 8-bit pattern 1111 1111 is 255 read as unsigned, and −1 read as signed.

Width Signed range Unsigned range
8 −128 to 127 0 to 255
16 −32,768 to 32,767 0 to 65,535
32 −2,147,483,648 to 2,147,483,647 0 to 4,294,967,295
64 −9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 0 to 18,446,744,073,709,551,615

A value outside the range keeps only its lowest N bits (overflow); the tool warns you and shows what remains.

Things to watch out for

  • Integers only — numbers with a fractional part aren’t supported.
  • Ordinary JavaScript numbers lose precision past 2⁵³ (about 9 quadrillion). This tool uses BigInt, so even numbers thousands of digits long convert exactly.

FAQ

How do I turn text into binary?

To convert characters into binary or hex bytes, use the Text ↔ Binary Converter.

Is my input stored?

No. Everything is calculated in your browser and nothing is uploaded.

Coming soon

Can't find the tool you need?

Tell us what you want to do. We build the most requested tools first.