Binary Numbers Explained — What They Are and How to Convert Them
Binary is the foundation of all computing. Every piece of data your computer processes — text, images, video, code, database records — is ultimately stored and manipulated as sequences of 0s and 1s. Understanding binary does not make you a better developer in every day tasks, but it does make a significant difference when you need to work with bitwise operations, file formats, network protocols, cryptography, or anything at the hardware level.
Convert binary to decimal, hex, octal, and text instantly with our free Binary Converter tool. For understanding related number systems, our Hex Converter, Decimal Converter, and Octal Converter tools cover all the conversions you need.
Why Computers Use Binary
Computers are built from billions of transistors — microscopic electronic switches that can be in one of two states: on or off. On maps to 1, off maps to 0. This physical two-state reality makes binary the natural number system for hardware. Any system with more states would require components that maintain more than two distinct voltage levels reliably, which is significantly harder to build, manufacture, and keep stable over time.
Everything in computing maps back to this binary foundation: integers stored as fixed-width binary numbers, floating point numbers using the IEEE 754 binary format, characters represented via ASCII or Unicode code points stored as binary, machine code instructions encoded as binary sequences, colours represented as binary values (each RGB channel is 8 bits), and network protocols that transmit binary frames.
The abstractions developers work with every day — strings, objects, arrays, images — are all built on top of binary. Understanding that foundation gives you a clearer mental model of what the computer is actually doing.
How Binary Numbers Work
Binary is base-2. Each position in a binary number represents a power of 2, just as each position in decimal represents a power of 10.
In decimal (base-10), the number 347 means: 3 times 100 (10 squared) plus 4 times 10 (10 to the first) plus 7 times 1 (10 to the zero). In binary (base-2), the number 10110101 means: reading right to left, the positions represent 1, 2, 4, 8, 16, 32, 64, 128.
Converting binary 10110101 to decimal: Position 0 (value 1): digit 1, contributes 1 Position 1 (value 2): digit 0, contributes 0 Position 2 (value 4): digit 1, contributes 4 Position 3 (value 8): digit 0, contributes 0 Position 4 (value 16): digit 1, contributes 16 Position 5 (value 32): digit 1, contributes 32 Position 6 (value 64): digit 0, contributes 0 Position 7 (value 128): digit 1, contributes 128 Total: 1 + 4 + 16 + 32 + 128 = 181
So 10110101 in binary equals 181 in decimal.
Converting Decimal to Binary
The standard algorithm: repeatedly divide by 2, record each remainder, then read the remainders from bottom to top.
Converting 181 to binary: 181 divided by 2 = 90, remainder 1 90 divided by 2 = 45, remainder 0 45 divided by 2 = 22, remainder 1 22 divided by 2 = 11, remainder 0 11 divided by 2 = 5, remainder 1 5 divided by 2 = 2, remainder 1 2 divided by 2 = 1, remainder 0 1 divided by 2 = 0, remainder 1 Reading remainders bottom to top: 10110101
This confirms our earlier conversion. The Binary Converter tool handles this instantly for any number — useful when you need to verify a conversion or work with very large values.
Bits, Bytes, and Their Significance
A bit is a single binary digit — 0 or 1. A byte is 8 bits. With 8 bits you can represent 256 different values (2 to the power of 8), from 0 to 255. This is why 255 appears so often in computing: the maximum value of an unsigned byte, the maximum value of each RGB colour channel, the maximum value in each octet of an IPv4 address.
Standard size units: 1 byte = 8 bits 1 kilobyte = 1024 bytes (2 to the power of 10) 1 megabyte = 1024 kilobytes 1 gigabyte = 1024 megabytes The use of 1024 rather than 1000 comes from binary — 1024 is 2 to the power of 10, making it the natural power-of-2 boundary near 1000. (Note: storage manufacturers use 1000 for marketing purposes, which is why a "500GB" hard drive shows as about 465GB in the operating system.)
Bitwise Operations in Programming
Bitwise operations work directly on the individual bits of integer values. They are fast — implemented as single CPU instructions — and appear frequently in systems programming, cryptography, and performance-critical code.
AND (symbol and): Both bits must be 1. Used for masking — checking whether specific bits are set. OR (symbol or): Either bit being 1 gives 1. Used for setting specific bits. XOR (symbol xor): Bits must differ. Used for toggling specific bits. NOT (symbol tilde): Inverts all bits. 0s become 1s, 1s become 0s. Left shift: Shifts bits left, filling with zeros on the right. Equivalent to multiplying by 2 for each position shifted. Right shift: Shifts bits right. Equivalent to dividing by 2 for each position shifted.
Practical example — Unix file permissions use bitwise logic: READ = 4 (binary 100) WRITE = 2 (binary 010) EXECUTE = 1 (binary 001) Permission 755 in octal means owner gets 7 (READ OR WRITE OR EXECUTE), group gets 5 (READ OR EXECUTE), others get 5. Testing whether a permission flag is set: permissions AND READ is nonzero if and only if the read bit is set.
Convert any binary number to decimal, hex, octal, or text — free and instant
Try Binary Converter Free →Binary in Practice — Where You Will See It
File signatures: binary files begin with a specific byte sequence (called a magic number) that identifies the file type. PNG files start with 89 50 4E 47 in hex. JPEG files start with FF D8. PDF files start with 25 50 44 46 in hex (which is %PDF in ASCII). Our File MIME Type Checker uses this to identify file types regardless of extension.
Network packets: IP packets, TCP segments, and other network protocol structures are defined in terms of their binary layout — specific bit positions controlling flags, header lengths, and protocol versions. Our HTTP Headers Lookup tool shows the high-level headers, but these are transmitted as structured binary data.
Cryptographic hashes: SHA-256 outputs a 256-bit (32-byte) binary value, usually displayed as 64 hexadecimal characters. The password strength of any hash depends on the number of bits — longer hashes have more possible values and are harder to brute-force. Check password strength with our Password Strength Checker.

