UseToolSuite UseToolSuite

Number Base Converter

Convert between any bases from 2 to 36 with arbitrary-precision arithmetic — no 2^53 ceiling — plus two’s complement at 8, 16, 32 and 64 bits, a grouped bit view, and strict validation that rejects digits the base cannot represent.

Binary (base 2)
-
Octal (base 8)
-
Decimal (base 10)
-
Hexadecimal (base 16)
-
Custom Base
-
ASCII Character
-

Reading numbers the way a computer does

Every base is just a different way of writing the same quantity. The number “two hundred fifty-five” is 255 in decimal, 0xFF in hex, 0o377 in octal, and 11111111 in binary — identical value, four notations. Choosing the right base isn’t about the number; it’s about what you’re trying to see:

BaseBest revealsWhere you meet it
Binary (2)Individual bits / flagsBitmasks, low-level I/O
Octal (8)3-bit groupsUnix file permissions
Decimal (10)Human-friendly magnitudeEveryday counting
Hex (16)Bytes and nibblesColors, memory, bytes, Unicode

Octal’s one surviving job: chmod

Octal feels archaic until you touch Linux permissions, where it’s perfect. Each permission digit packs three bits — read (4), write (2), execute (1) — so a single octal digit (0–7) describes one permission group exactly. chmod 755 reads as 7=rwx for the owner, 5=r-x for group, 5=r-x for others. The mapping is so clean precisely because 8 = 2³, and there are three permission bits per group. That alignment is why octal, not decimal, survived here.

Big numbers without precision loss

A subtle trap in many converters: JavaScript’s regular numbers lose precision above 2⁵³ (9,007,199,254,740,991), silently turning the last digits of huge values into zeros. This tool uses BigInt, so you can convert numbers with hundreds of digits — cryptographic values, large hashes, 64-bit identifiers — without corruption. If you’ve ever seen a large ID’s trailing digits mysteriously become 000, that’s the IEEE 754 limit, and BigInt is the fix both here and in your own code.

A note on negatives and fractions

This converter handles unsigned whole integers. Negative numbers in binary use two’s complement — invert the bits and add one — which requires knowing the bit width (8-bit, 16-bit, 32-bit) because the sign lives in the top bit, so a plain base conversion can’t represent them unambiguously. Fractional values introduce repeating expansions (0.1 decimal is an infinite binary fraction), which is its own complexity. For both, you handle the sign or fraction logic explicitly; the converter covers the integer core that underlies them.

Last updated Built and maintained by Necmeddin Cunedioglu How tools are tested

How helpful was this tool?

Click to rate

Key Concepts

Binary (Base 2)

A number system using only two digits: 0 and 1. Binary is the fundamental language of computers — every piece of data is ultimately stored and processed as binary values. Each binary digit (bit) represents an on/off state in an electronic circuit. Eight bits make one byte, which can represent 256 different values (0-255).

Hexadecimal (Base 16)

A number system using 16 symbols: 0-9 and A-F. Hexadecimal is widely used in programming because each hex digit maps exactly to 4 binary bits, making it a compact and human-readable representation of binary data. Common uses include memory addresses, color codes (#FF5733), and byte values in debugging.

Octal (Base 8)

A number system using digits 0-7. Octal was historically important in early computing (PDP-8, Unix file permissions). Today its primary use is Unix/Linux file permissions: chmod 755 sets rwxr-xr-x, where each digit represents a 3-bit permission group (read=4, write=2, execute=1).

Frequently Asked Questions

What is the largest number this tool can convert?

The tool uses JavaScript BigInt for conversions, which supports arbitrarily large integers. You can convert numbers with hundreds of digits without losing precision, unlike tools limited to 64-bit integers.

Can I convert between bases other than 2, 8, 10, and 16?

The tool focuses on the four most commonly used bases in programming: binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16). Custom bases like base 3 or base 36 are not currently supported.

Does the tool handle negative numbers?

The tool is designed for unsigned (positive) integers. For negative numbers in binary representation (such as two's complement), you would need to handle the sign bit manually.

Can I convert floating-point numbers between bases?

No. This tool converts whole integers only. Floating-point base conversion involves additional complexity with repeating fractions and is not supported in this tool.

Why does this reject "12" as a binary number when other converters accept it?

Because 12 is not a binary number — base 2 only has the digits 0 and 1. Many converters are built on JavaScript’s parseInt, which stops at the first digit it cannot read rather than reporting a problem: parseInt("12", 2) returns 1, silently answering a different question than the one you asked. This tool validates every digit against the selected base and tells you which one is wrong.

Can it handle numbers larger than 2^53?

Yes. The arithmetic runs on BigInt, so there is no precision ceiling — 9007199254740993 converts exactly rather than coming back as ...992, which is what happens in any converter built on JavaScript numbers. A 30-digit value round-trips through base 36 and back without losing a digit.

Why show two’s complement instead of just a minus sign?

Because a minus sign is not how a negative number exists in memory. A debugger, a register dump or a wire protocol shows you the two’s complement form, so "-5" is 11111011 as an 8-bit value and 0xFFFB as a 16-bit one. A converter that prints "-101" cannot help you match what you are actually looking at. Widths the value does not fit in are omitted, with a note saying why rather than leaving you guessing.

How do I quickly convert hex to binary in my head?

Each hexadecimal digit maps to exactly four binary digits (a 'nibble'), so you can convert digit-by-digit without doing any math on the whole number. Memorize the 16 nibbles (0=0000, 1=0001, ... 9=1001, A=1010, B=1011, C=1100, D=1101, E=1110, F=1111) and the conversion is pure lookup: 0x3F is 0011 1111, 0xA0 is 1010 0000. This 1-hex-digit = 4-bits relationship is the entire reason hex exists — it's a compact, human-readable shorthand for binary. Going the other way, group bits into fours from the right and translate each group.

Why do programmers use hexadecimal instead of decimal?

Because hex aligns perfectly with how computers store data, and decimal doesn't. One byte is 8 bits = exactly two hex digits (00 to FF = 0 to 255), so memory dumps, color codes, and byte values read cleanly in hex. Decimal hides the bit structure — 255 tells you nothing about its bits, but 0xFF immediately says 'all eight bits set.' That's why you see hex in color codes (#FF5733), memory addresses (0x7FFE), MAC addresses, Unicode code points (U+1F600), and bitmask flags. Hex is the bridge between unreadable raw binary and human eyes.

Troubleshooting & Technical Tips

Invalid character error: Character "G" or higher in hexadecimal input

Hexadecimal (base 16) only accepts the characters 0-9 and A-F. Entering an invalid character like "G" causes parseInt() to return NaN. Verify that your input contains only characters valid for the target base: binary uses 0-1, octal uses 0-7, decimal uses 0-9, and hexadecimal uses 0-9 and A-F.

Precision loss: Last digits become zero for large numbers

In JavaScript, numbers above Number.MAX_SAFE_INTEGER (2^53 - 1 = 9007199254740991) suffer from precision loss due to IEEE 754 floating-point arithmetic. This tool uses BigInt to solve this problem, but when working with large numbers in your own code, use the BigInt type or arbitrary-precision libraries.

Octal prefix confusion: 0o vs 0 prefix difference

In ES6+ JavaScript, octal numbers are written with the 0o prefix (e.g., 0o17). The legacy 0 prefix syntax (017) produces a SyntaxError in strict mode. When entering octal values in this tool, enter the number directly without any prefix and select Octal as the input base.

Related Guides

Related Tools

Embed this tool on your site

Paste this snippet into any HTML page or blog post to embed a live, fully working copy of Number Base Converter. Free for any use.