Number Base Converter

Convert numbers between binary, octal, decimal, and hexadecimal. All bases shown simultaneously.

Decimal (Base 10)
255
Hex (Base 16)
0xFF
Binary (Base 2)
0b11111111
Octal (Base 8)
0o377

What is Number Base Conversion?

Computers store all data as binary (base 2), but programmers frequently need to read and write numbers in other bases — decimal (base 10) for everyday math, hexadecimal (base 16) for memory addresses and colors, and octal (base 8) for Unix file permissions.

Decimal (base 10) uses digits 0–9 and is what we use in everyday life. Binary (base 2) uses only 0 and 1 — the native language of computer hardware. Hexadecimal (base 16) uses 0–9 and A–F; each hex digit represents exactly 4 bits, making it a compact way to read binary values. Octal (base 8) uses 0–7; each octal digit represents 3 bits and is commonly used for Unix permission masks.

For example, the decimal value 255 is 0xFF in hex, 0b11111111 in binary, and 0377 in octal. All four represent the same value — the base just determines how it is written.

Quick Reference

DecimalHexBinaryOctal
0000
1111
88100010
10A101012
15F111117
16101000020
322010000040
64401000000100
1288010000000200
255FF11111111377
256100100000000400

Number Bases in Code

BaseJavaScriptPythonGo
Decimal255255255
Hex0xFF0xFF0xFF
Binary0b111111110b111111110b11111111
Octal0o3770o3770377

Frequently Asked Questions

Hex is used for colors (#FF5733), memory addresses, byte values, bit masks, and cryptographic hashes. It's compact — each hex digit represents exactly 4 bits.

Binary is used for bit manipulation, flags, permissions (chmod 755 = 111 101 101), network subnet masks, and low-level hardware operations.

Octal is primarily used for Unix file permissions (chmod 755). Each octal digit represents 3 bits: read (4), write (2), execute (1).

This tool uses JavaScript's parseInt() which handles integers up to 2^53-1 (Number.MAX_SAFE_INTEGER). For arbitrary-precision numbers, BigInt arithmetic is needed.

Related Tools