๐Ÿ”ข Universal Number Converter

Binary, Decimal, Hexadecimal & ASCII Converter

Convert a Decimal (Base-10) number instantly into Binary (Base-2), Hexadecimal (Base-16), Octal (Base-8), and its ASCII character.

Whole numbers of any size are converted exactly. Negative numbers are shown with a minus sign (sign-magnitude).

Binary (Base-2)
11111111
Hexadecimal (Base-16)
0xFF
Octal (Base-8)
377
ASCII Character
N/A

Positional notation in any base

Every number system used here is positional: each digit is multiplied by the base raised to the power of its position, counting from zero on the right. In decimal, 2026 is 2 ร— 1000 + 0 ร— 100 + 2 ร— 10 + 6.

The same value in binary is 11111101010, which is 1024 + 512 + 256 + 128 + 64 + 32 + 8 + 2. In hexadecimal it is 7EA: 7 ร— 256 + 14 ร— 16 + 10 = 2026, where E stands for 14 and A for 10. In octal it is 3752: 3 ร— 512 + 7 ร— 64 + 5 ร— 8 + 2.

Converting by hand with repeated division

To convert decimal to another base, divide by the base repeatedly and collect the remainders from last to first. For 2026 to hex: 2026 รท 16 = 126 remainder 10 (A), 126 รท 16 = 7 remainder 14 (E), 7 รท 16 = 0 remainder 7. Reading upward gives 7EA.

Converting between binary, octal and hex is faster with grouping, because 16 is 2^4 and 8 is 2^3. Split the bits into groups of four from the right for hex: 0111 1110 1010 becomes 7 E A. Groups of three give octal: 011 111 101 010 becomes 3 7 5 2.

Where each base appears in practice

Hexadecimal is compact shorthand for bytes, since two hex digits represent exactly eight bits. You see it in CSS colours, where #FF8800 means red 255, green 136, blue 0, in memory addresses, and in hashes and UUIDs.

Octal survives mainly in Unix file permissions. Each digit packs read (4), write (2) and execute (1) for owner, group and others, so 755 means rwx for the owner and r-x for everyone else.

Binary is the natural view for bit flags and network masks. 255 is 11111111, a full byte, which is why a subnet mask of 255.255.255.0 has 24 leading one-bits.

In ASCII, uppercase A is 65 and lowercase a is 97. They differ by exactly 32, a single bit, which is why case conversion can be done with one bit operation.

Negative numbers, very large numbers and Unicode

The converter writes negative numbers in sign-magnitude form, with a minus sign in front of the magnitude, so โˆ’10 becomes โˆ’1010. Computers store signed integers in two's complement instead: in 8 bits, โˆ’10 is 11110110, and in 32 bits it is FFFFFFF6 in hex. When you enter a negative number, the converter also shows the two's complement form for a bit width you choose (8, 16, 32 or 64 bits), and tells you if the value does not fit.

Ordinary JavaScript numbers are exact only up to 9,007,199,254,740,991 (2^53 โˆ’ 1), so this converter parses your input as a BigInt instead. Whole numbers of any length are converted exactly, digit for digit. Type plain digits with an optional leading minus sign: decimals and exponent notation such as 1e3 are rejected with a message rather than silently truncated.

The ASCII card covers printable codes 32 to 126. Characters beyond that belong to Unicode, where a code point can be far larger than one byte and is encoded differently in UTF-8 and UTF-16.

Number Base Converter: frequently asked questions

How do I convert binary to decimal by hand?

Write the powers of two above each bit from the right (1, 2, 4, 8 and so on) and add the ones where the bit is 1. For 1000001 that is 64 + 1 = 65, the ASCII code for A.

Why do programmers use hexadecimal instead of binary?

Hex is far shorter and maps cleanly to bits, one hex digit per four bits. A 32-bit value needs 32 binary digits but only 8 hex digits, which makes it much easier to read and compare.

What does the 0x prefix mean?

It marks a number as hexadecimal in C, JavaScript, Python and many other languages, so 0x10 means 16 rather than ten. Similar prefixes are 0b for binary and 0o for octal in several languages.

How does chmod 755 relate to octal?

Each octal digit is three permission bits. 7 is 111 (read, write, execute) and 5 is 101 (read and execute). Entering 493 in the converter shows the octal value 755, because chmod values are octal numbers.

What is the largest number this converter handles accurately?

There is no practical limit for whole numbers. The input is parsed as a BigInt, so even values far beyond 9,007,199,254,740,991 (the largest integer a normal JavaScript number holds exactly) convert to exact binary, hex and octal.

All currency & unit converters