Binary Converter
Convert between binary, decimal, octal, and hexadecimal number systems. View bit groupings, byte counts, and padded representations.
Binary Converter
Calculator
Adjust values & calculateEnter your values below. Every result is computed in your browser โ no data is sent to any server.
Formula: Decimal = sum of (bit x 2^position)
Worked example โ 200 = 11001000 (binary) = 310 (octal) = C8 (hex)
Formula
Decimal = sum of (bit x 2^position)
Each binary digit (bit) represents a power of 2 based on its position from right to left, starting at position 0. To convert binary to decimal, multiply each bit by 2 raised to its position power and sum the results. For example, binary 1010 = 1x8 + 0x4 + 1x2 + 0x1 = 10.
Worked Examples
Example 1: Decimal 200 to Binary
Problem:Convert decimal number 200 to binary.
Solution:200 / 2 = 100 r 0 100 / 2 = 50 r 0 50 / 2 = 25 r 0 25 / 2 = 12 r 1 12 / 2 = 6 r 0 6 / 2 = 3 r 0 3 / 2 = 1 r 1 1 / 2 = 0 r 1 Binary: 11001000
Result:200 = 11001000 (binary) = 310 (octal) = C8 (hex)
Example 2: Binary 10110 to Other Bases
Problem:Convert binary 10110 to decimal, octal, and hexadecimal.
Solution:Decimal: 1x16 + 0x8 + 1x4 + 1x2 + 0x1 = 22 Octal: 22 / 8 = 2 r 6 -> 26 Hex: 22 / 16 = 1 r 6 -> 16
Result:10110 (binary) = 22 (decimal) = 26 (octal) = 16 (hex)
Frequently Asked Questions
What is binary and why do computers use it?
Binary is a base-2 number system that uses only two digits: 0 and 1. Computers use binary because their fundamental building blocks (transistors) have two states: on and off. These two states map perfectly to the binary digits 1 and 0. Every piece of data a computer processes, from text to images to programs, is ultimately represented as sequences of binary digits (bits). This simplicity makes digital circuits reliable and efficient to manufacture.
How do I convert decimal to binary?
To convert a decimal number to binary, repeatedly divide the number by 2 and record the remainder. Continue until the quotient is 0. Then read the remainders from bottom to top. For example, to convert 13: 13/2 = 6 remainder 1, 6/2 = 3 remainder 0, 3/2 = 1 remainder 1, 1/2 = 0 remainder 1. Reading bottom to top gives 1101. So decimal 13 equals binary 1101.
What is the difference between binary, octal, and hexadecimal?
These are all positional number systems with different bases. Binary is base 2 (digits 0-1), octal is base 8 (digits 0-7), and hexadecimal is base 16 (digits 0-9 plus A-F). They are related by powers of 2: each octal digit corresponds to exactly 3 binary bits, and each hexadecimal digit corresponds to exactly 4 binary bits. This relationship makes conversions between them straightforward and is why all three are commonly used in computing.
What are bits and bytes?
A bit (binary digit) is the smallest unit of data in computing, representing a single 0 or 1. A byte consists of 8 bits and can represent values from 0 to 255 in unsigned form. Bytes are the standard unit for measuring data storage and transfer. A kilobyte is 1,024 bytes, a megabyte is 1,048,576 bytes, and so on. When we say a number requires a certain number of bits, we mean the minimum binary digits needed to represent that value.
How do I convert binary to hexadecimal without going through decimal?
Group the binary digits into sets of 4 starting from the right, padding the leftmost group with zeros if needed, then convert each group directly to its hex digit. For example, 10110110 splits into 1011 and 0110, which are B and 6 in hex, giving 0xB6. This works because 16 is 2 to the 4th power, so each hex digit exactly represents 4 bits with no rounding or remainder. The same grouping trick works for octal using groups of 3 bits, since 8 is 2 cubed.
What is two complement and how does it represent negative numbers?
Two complement is the standard way signed integers are stored. To negate a value, invert every bit and add 1. Decimal 5 in eight bits is 00000101; inverting gives 11111010, and adding 1 gives 11111011, which is -5. The leading bit acts as a sign flag, so an 8-bit two complement byte covers -128 to 127 and a 16-bit word covers -32,768 to 32,767. The scheme is used because ordinary binary addition then works unchanged for negative operands, with no separate subtraction circuit.
How many bits do I need to represent a given decimal number?
For a non-negative integer N, the bit count is the position of its highest set bit, which is the floor of log base 2 of N, plus one. Decimal 1000 needs 10 bits because 2 to the 9th is 512 and 2 to the 10th is 1024, so 1000 falls in the 10-bit range. Put differently, n bits represent 0 through 2 to the n minus 1. This determines whether a value fits in a byte, a 16-bit word, or a wider field before it overflows.
Why is a kilobyte sometimes 1000 bytes and sometimes 1024?
Memory is addressed in powers of two, so 2 to the 10th, or 1024, became the natural step and was loosely called a kilobyte. Storage vendors and networking instead use the decimal SI meaning of kilo, so 1000. The IEC introduced separate binary prefixes to end the ambiguity: a kibibyte, KiB, is exactly 1024 bytes and a mebibyte, MiB, is 1024 KiB. That mismatch is why a drive sold as 1 TB is reported by some operating systems as roughly 931 GiB.
What does shifting a binary number left or right actually do?
A left shift moves every bit one position toward the most significant end and pads with a zero on the right, which multiplies the value by 2. Binary 1011, decimal 11, shifted left once becomes 10110, decimal 22. A logical right shift moves bits the other way and discards the rightmost bit, halving the value and rounding toward zero, so 1011 becomes 101, decimal 5. Shifts are far cheaper than multiplication in hardware, so compilers often replace multiplication or division by a power of two with a shift.
Why do color codes and memory addresses use hexadecimal?
Hexadecimal packs exactly four bits into one character, so a byte is always two hex digits and a 32-bit address is always eight. A web color such as B60A3C splits into three byte-sized channels, B6 for red, 0A for green and 3C for blue, each spanning 0 to 255. The same compactness makes hex the default for memory dumps, opcodes and bitmask constants, usually written with an 0x prefix, because the digit boundaries line up with the underlying bit fields.
References
Reviewed for accuracy by Manoj Kumar, Mathematics Educator ยท Editorial policy
Related Calculators
๐งฎAsciito Binary Converter
Calculate asciito binary converter with inputs, formulas, and instant results.
๐งฎBytes Converter
Convert between bytes, KB, MB, GB, TB, and PB in both binary and decimal systems.
๐งฎTorque Unit Converter
Calculate torque unit converter with inputs, formulas, and instant results.
๐งฎElectrical Resistance Converter (ฮฉ, kฮฉ, Mฮฉ)
Calculate electrical resistance unit converter with inputs, formulas, and instant results.
๐งฎTime Unit Converter
Calculate time unit converter with inputs, formulas, and instant results.
๐งฎArea Converter
Calculate area converter with inputs, formulas, and instant results.
๐งฎAresto Hectares Converter
Calculate aresto hectares converter with inputs, formulas, and instant results.
๐งฎCentimeter to Inch Converter
Calculate centimeter to inch converter with inputs, formulas, and instant results.