Number Base Converter
Free online number base converter between binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16)
Loading...
Free online number base converter between binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16)
Enter a number in any base to convert
0xFF is instantly recognizable as eight set bits (11111111). Hex is also the foundation of hex color codes, where a six-digit hex value like #1A2B3C encodes red, green, and blue channels as three pairs of base-16 digits.11010110 splits into 1101 (D) and 0110 (6), giving 0xD6. Going the other way, expand each hex digit back to four bits. This works because 16 = 2⁴, so hex and binary share a direct positional relationship, with no division or modular arithmetic required.chmod 755 is three octal digits encoding read (4), write (2), and execute (1) bits for owner, group, and others. Octal was also the preferred human-readable base on early systems with 12-, 24-, or 36-bit word sizes that divided evenly into groups of three bits. Today decimal and hex have mostly replaced it, but you will still encounter octal literals in C, Python, and shell scripts.0x (or 0X) denotes hexadecimal, 0b (or 0B) denotes binary, and 0o (or a leading 0 in C) denotes octal. For example, 0xFF, 0b11111111, and 0o377 all equal 255 in decimal. Languages including JavaScript, Python, Rust, Go, and Swift support all three prefixes. Use our converter above to verify these equivalences instantly.0777 intending decimal 777. Python 3 fixed this by requiring 0o777 for octal and raising a SyntaxError on bare leading zeros. Rust, Go, and Swift adopted the same 0b/0o/0x convention. JavaScript added 0b and 0o in ES2015, but watch out: parseInt("077") may return 63 (octal) in some engines, so always pass a radix: parseInt("077", 10).