Number Base Converter
Convert numbers between binary, octal, decimal, and hex
Input base
11111111
0b11111111
377
0o377
255
FF
0xFF
Quick examples
Number Base Converter: Binary, Octal, Decimal & Hex
This converter lets you instantly convert any integer between the four number bases most commonly used in computing: binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16). It uses JavaScript's BigInt internally, so it handles arbitrarily large numbers with full precision โ no floating-point rounding errors.
The Four Bases
Binary (Base 2) uses digits 0 and 1. Computers represent every datum โ integers, floating-point numbers, text, images, instructions โ ultimately as sequences of bits. Understanding binary arithmetic underpins bitwise operations, bit masking, flags, and protocol field decoding.
Octal (Base 8) uses digits 0โ7. Its primary modern use is Unix file permissions (chmod values like 755 or 644), where each octal digit encodes three permission bits (read, write, execute).
Decimal (Base 10) is the everyday number system humans use. It is the bridge between the mathematical representation and the human-readable value.
Hexadecimal (Base 16) uses digits 0โ9 and AโF (or aโf). Each hex digit represents exactly 4 bits, making it the most compact readable form of binary data. It appears in memory addresses, color codes, hashes, byte-level protocol fields, and assembly language.
Conversion Examples
- 255โโ = 11111111โ = 377โ = FFโโ (one full byte, all bits set)
- 1024โโ = 10000000000โ = 2000โ = 400โโ (2ยนโฐ)
- 42โโ = 101010โ = 52โ = 2Aโโ
- 16โโ = 10000โ = 20โ = 10โโ
How to Read Hex Colors
CSS/HTML hex colors like #1A2B3C encode red, green, and blue channels as two hex digits each: #RRGGBB. So #1A2B3C is R=1Aโโ=26, G=2Bโโ=43, B=3Cโโ=60. This converter makes decoding any color channel to its decimal value trivial.
Unix File Permissions (Octal)
When you run chmod 755 file, each octal digit maps to three permission bits for owner, group, and others:
- 7 = 111โ = read + write + execute
- 6 = 110โ = read + write
- 5 = 101โ = read + execute
- 4 = 100โ = read only
- 0 = 000โ = no permissions