Skip to content

Number base converter: binary to decimal, hex and octal

Programmers read memory dumps in hexadecimal, students learn binary to decimal by hand, network engineers count bits in masks, and Unix permissions are written in octal. This converter takes a number written in any base from 2 to 36 and shows it in binary, octal, decimal, hexadecimal and one more base of your choice at the same time. It works with whole numbers of thousands of digits without losing a single one, converts fractions and marks repeating digits, shows the two's complement bit pattern for 8, 16, 32 and 64 bits, and turns text into binary or hex bytes and back. Everything runs in your browser.

Quick answer

To convert binary to decimal, multiply each bit by its power of two and add them up: 1011 is 8 + 0 + 2 + 1 = 11. Type the number above, choose the base it is written in, and the converter shows it in binary, octal, decimal, hexadecimal and any base from 2 to 36 at once.

Runs in your browser

Based on IETF RFC 3629: UTF-8, a transformation format of ISO 10646 · Page updated 23 October 2026

Editor: Abuzar, founder of NeedMyToolsHow we check facts

Number to convert

Any length. A minus sign, a fraction point, spaces, underscores, 0x / 0b / 0o prefixes and Arabic-Indic digits are fine.

It is written in

The same number in every base

  • Binary (base 2)

    1111 1111

    8 digits

  • Octal (base 8)

    377

    3 digits

  • Decimal (base 10)

    255

    3 digits

  • Hexadecimal (base 16)

    FF

    2 digits

  • Base 36

    73

    2 digits

Two's complement (8 bits)

Signed range: -128 … 127 · Unsigned range: 0 … 255

Pattern in hex
0xFF
Read as signed
-1
Read as unsigned
255

This value only fits as an unsigned number; as a signed number the same bits mean the value shown above.

Text to binary and hex (UTF-8)

Bytes
01001000 01100101 01101100 01101100 01101111 00100000 11011001 10000101 11011000 10110001 11011000 10101101 11011000 10101000 11011000 10100111

16 bytes

Characters, code points and UTF-8 bytes (first 40)
CharacterCode pointUTF-8
HU+004848
eU+006565
lU+006C6C
lU+006C6C
oU+006F6F
␠U+002020
مU+0645D9 85
رU+0631D8 B1
حU+062DD8 AD
بU+0628D8 A8
اU+0627D8 A7

How to use the Number Base Converter

  1. Type or paste the number. Prefixes such as 0x or 0b, spaces, underscores and Arabic-Indic digits are accepted.
  2. Choose the base it is written in: binary, octal, decimal, hex, or any base from 2 to 36 in the list.
  3. Read the same number in every base and press Copy next to the one you need; pick an extra output base if you need, say, base 36.
  4. For a whole number, choose 8, 16, 32 or 64 bits to see its two's complement pattern, then download everything as a text file.

How number bases work

In a positional system each digit is worth its value times a power of the base. In decimal, 345 means 3 hundreds, 4 tens and 5 ones. Binary uses only 0 and 1 and powers of two, so 1011 is one 8, no 4, one 2 and one 1, which is 11. Octal groups binary digits in threes and hexadecimal in fours, which is why one hex digit always stands for exactly four bits and two hex digits for one byte. Bases above 10 borrow letters for the extra digits: a is 10, f is 15, and base 36 runs all the way to z for 35. Base 36 is handy for short IDs because it packs the most value into ordinary letters and digits.

Huge numbers stay exact

Most online calculators store numbers as 64-bit floating point, which can only hold whole numbers exactly up to 9,007,199,254,740,991. Beyond that the last digits are quietly rounded, so a long hash or a 64-bit ID comes back wrong. This converter uses whole-number arithmetic of any size in the browser, so a 5,000-digit decimal number converts to binary and back without a single digit changing. Inputs are limited to 20,000 characters to keep the page responsive on phones.

Two's complement in 8, 16, 32 and 64 bits

Computers store negative whole numbers in two's complement: take the positive value in binary, flip every bit and add 1. In 8 bits, 1 is 00000001, so -1 is 11111111, which is FF in hex. The same pattern means 255 if you read it as unsigned, which is why the tool shows both readings. An 8-bit signed number runs from -128 to 127, 16 bits from -32,768 to 32,767, and 32 bits from about -2.1 billion to 2.1 billion. Choose a width to see the pattern bit by bit with the bit positions under each group of four. If a value does not fit the width you chose, the tool tells you instead of silently cutting it.

Fractions and repeating digits

Fractions convert too. 0.5 in decimal is 0.1 in binary and 10.625 is 1010.101, but 0.1 has no exact binary form: it is 0.0001100110011… for ever. The converter finds the repeating block and writes it in brackets, 0.0(0011), which explains the familiar rounding surprises in programming where 0.1 + 0.2 is not exactly 0.3. When a fraction does not end or repeat within 64 digits it is cut there and the page says so; the whole-number part is always exact.

Text to binary and hex with UTF-8

The text panel shows the bytes a computer stores for your text. UTF-8, the encoding defined in RFC 3629 and used by almost every web page, writes the 128 ASCII characters in one byte each, characters up to code point U+07FF, which includes the Arabic letters, in two bytes, most other scripts in three, and emoji in four. So "Hi" is 48 69 in hex, the Arabic letter meem is D9 85, and a smiling face takes four bytes. You can choose binary, hex or decimal bytes, switch to strict ASCII to catch characters outside 0-127, or paste bytes to decode them back to text. A table under the result lists each character with its code point, which helps when you debug garbled text.

Frequently asked questions

How do I convert binary to decimal by hand?

Write the powers of two under the bits from the right: 1, 2, 4, 8, 16 and so on. Add the powers that sit under a 1. For 110101 that is 32 + 16 + 4 + 1 = 53. To go the other way, divide by 2 repeatedly and read the remainders from the bottom up.

What is two's complement, and why is 11111111 equal to -1?

It is the way computers store negative whole numbers: flip the bits of the positive value and add 1. In 8 bits, 1 is 00000001; flipped it is 11111110, and adding 1 gives 11111111. Read as unsigned, the same bits are 255.

Why does 0.1 never come out exact in binary?

Only fractions whose denominator is a power of two end in binary. One tenth has a factor of 5 in its denominator, so in binary it repeats for ever as 0.0(0011). Computers cut it off, which is why 0.1 + 0.2 shows 0.30000000000000004 in many programming languages.

How many bytes does an Arabic letter take in UTF-8?

Two. Arabic letters sit between U+0600 and U+06FF, and UTF-8 writes every code point from U+0080 to U+07FF in two bytes. The letter meem, U+0645, is D9 85 in hex. Plain English letters take one byte and most emoji take four.

What is the largest number this converter can handle?

Any whole number up to 20,000 characters long, converted exactly. Fractions are expanded up to 64 digits after the point, with repeating blocks detected. Everything is worked out on your device, so very large inputs depend a little on its speed.