Loading...
Loading...
Free online number base converter. Convert numbers between binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16) instantly.
Number base conversion is a fundamental operation in computer science and programming. Different bases are used for different purposes: binary (base 2) for machine-level operations, octal (base 8) for Unix file permissions, decimal (base 10) for human-readable numbers, and hexadecimal (base 16) for memory addresses, color codes, and low-level debugging.
Binary is the native language of computers — every piece of data in a computer is ultimately represented as a sequence of 0s and 1s. Understanding binary is essential for bitwise operations, network addressing (IPv4 octets are 8-bit binary numbers), and understanding how computers store and process data at the most fundamental level.
Hexadecimal is the most commonly used base in programming after decimal. It maps cleanly to binary (each hex digit represents exactly 4 bits), making it ideal for representing binary data in a more human-readable form. Hex is used for color codes (#FF5733), memory addresses, Unicode code points (U+0041), and cryptographic hash representations.
Conversion between bases relies on understanding place value. A number in any base can be expressed as the sum of each digit multiplied by the base raised to its position power (starting from 0 on the right). To convert from decimal to another base, repeatedly divide by the target base and collect the remainders from right to left.
This converter provides real-time conversion between binary, octal, decimal, and hexadecimal. As you type in any base, all other bases update instantly. Use it for debugging IP addresses, understanding color values, working with memory dumps, or learning how different number systems represent the same value.
Understanding binary arithmetic is fundamental to low-level programming. Bitwise operations like AND (&), OR (|), XOR (^), and NOT (~) operate directly on binary representations and are used for flag manipulation, permissions masking, efficient data packing, and cryptographic algorithms. Octal, though less common today, remains essential for Unix file permission masks like chmod 755, where each digit represents read (4), write (2), and execute (1) permissions for owner, group, and others.
Hexadecimal is much more compact and readable than binary. A 32-bit binary number like 11111111111111110000000000000000 becomes 0xFFFF0000 in hex — 8 characters instead of 32. Each hex digit represents exactly 4 bits, making conversion between hex and binary straightforward.
Base64 is a different type of encoding that maps binary data to a 64-character set (A-Z, a-z, 0-9, +, /). Unlike base conversions which change the representation of a number, base64 is used to encode arbitrary binary data (images, files) as text for transmission over text-based protocols like email and JSON.
Repeatedly divide the decimal number by 2 and record the remainder. The remainders, read from last to first, form the binary number. For example, 13 ÷ 2 = 6 remainder 1, 6 ÷ 2 = 3 remainder 0, 3 ÷ 2 = 1 remainder 1, 1 ÷ 2 = 0 remainder 1. Reading remainders backward: 1101.
Each octal digit maps to exactly 3 bits, which corresponds to the three permission bits (read, write, execute) for a user class. chmod 755 translates to binary 111 101 101 — owner gets all permissions, group and others get read+execute. This direct mapping makes octal natural for representing permission triples.
Two's complement is how computers represent signed integers in binary. The leftmost bit indicates the sign (0 = positive, 1 = negative). To negate a number, invert all bits and add 1. For example, -5 is represented as 11111011 in 8-bit two's complement. This scheme simplifies hardware because addition and subtraction use the same circuitry regardless of sign.