Advertisement · 728×90
Binary Converter

Binary, Decimal, Hex,
Octal & Text

Convert between binary, decimal, hexadecimal, and octal number systems instantly. Also translates text to binary (ASCII) and back. Perfect for CS students and developers.

01

Number Base Converter

Bit Visualization
Text to Binary
Binary (ASCII)
Binary to Text
Decoded Text
Advertisement · 728×90

How Binary Numbers Work

Binary is base-2, using only 0 and 1. Each position represents a power of 2:

To convert binary to decimal: multiply each digit by its positional value and add. Binary 1011=(1×8)+(0×4)+(1×2)+(1×1)=11. Binary 11111111=128+64+32+16+8+4+2+1=255.

Why Computers Use Binary

A transistor — the fundamental building block of modern processors — has two stable states: conducting (1) and not conducting (0). These map directly to binary's two digits. Distinguishing two voltage levels is far more reliable than distinguishing ten. Binary also enables logic gates — AND, OR, NOT, XOR — which implement all arithmetic and logic through simple transistor combinations. Modern CPUs contain billions of such transistors operating billions of times per second.

Hexadecimal — Binary's Shorthand

Hexadecimal (base 16) uses digits 0–9 and A–F (A=10, B=11...F=15). Each hex digit represents exactly 4 binary bits:

Hex appears everywhere: web colors (#FF5733), memory addresses (0x7FFE4A20), file signatures (JPEGs start with FF D8 FF). The 0x prefix indicates hexadecimal — 0xFF=255, 0x1A=26.

Bits, Bytes, and Data Storage

Two's Complement — How Computers Handle Negative Numbers

To negate a binary number using two's complement: flip all bits, then add 1. In 8-bit: +1=00000001. Flip: 11111110. Add 1: 11111111=−1. The leftmost bit is the sign bit (0=positive, 1=negative). This allows subtraction to be performed using the same addition hardware as positive numbers — a key CPU design simplification.

ASCII — Text in Binary

ASCII maps characters to numbers (0–127). A=65=01000001, a=97=01100001, space=32=00100000. The case difference in ASCII between uppercase and lowercase letters is exactly 32 (00100000) — a single bit toggle switches case. ASCII was extended to Unicode (UTF-8), which supports all world scripts and emoji using 1–4 bytes per character, while keeping ASCII characters as valid single-byte sequences for backward compatibility.

Octal — Base 8 and Unix Permissions

Octal (base 8) uses digits 0–7. Each octal digit represents exactly 3 binary bits. Today octal survives primarily in Unix/Linux file permissions. chmod 755 sets permissions in octal: 7 (111=rwx), 5 (101=r-x), 5 (101=r-x). The three digits represent permissions for owner, group, and others respectively. Understanding octal is essential for Unix/Linux system administration.

Bitwise Operations in Programming

Binary Converter — Frequently Asked Questions

How do you convert binary to decimal?
Assign each bit a positional value as a power of 2 from right to left (1, 2, 4, 8, 16...). Multiply each bit by its value and add. Example: 1011=8+0+2+1=11. Example: 11111111=128+64+32+16+8+4+2+1=255.
Why do computers use binary instead of decimal?
Transistors have two stable states (on/off), mapping directly to 1 and 0. Distinguishing two voltage levels is far more reliable than distinguishing ten. Binary also enables simple logic gates that implement all computation.
What is the difference between binary and hexadecimal?
Binary is base 2 (digits 0–1); hex is base 16 (digits 0–9 and A–F). Each hex digit represents exactly 4 binary bits. A byte (8 bits) is always two hex digits (00 to FF = 0 to 255).
What does 0xFF mean?
0xFF is hex for 255 — binary 11111111, all 8 bits set. Appears in web colors (white=#FFFFFF), memory addresses, and bitmasks. The 0x prefix indicates hexadecimal in most programming languages.
How do computers represent negative numbers in binary?
Using two's complement: flip all bits, then add 1. In 8-bit, −1=11111111. The leftmost bit is the sign bit (0=positive, 1=negative). This lets subtraction use the same hardware as addition, simplifying CPU design greatly.