Binary Converter

In binary
1101.101
โ€”
Bits (integer part)
4
In hexadecimal
D.A
In octal
15.5
Ones among the bits
5
The place values at work

Every binary place is a power of two โ€” filled bars are the ones your number actually uses. That's all binary is: a checklist of which powers of two to add.

The conversion, step by step

Why some tidy decimals repeat forever in binary: a fraction terminates in base 2 only if its denominator is a pure power of two. One tenth is 1/10 = 1/(2ยท5) โ€” that stray 5 condemns 0.1 to the infinite tail 0.0(0011), which is the seed of the most famous bug-that-isn't in computing (the Inside a Float tab tells the whole story). Our hexadecimal, octal, and duodecimal converters play the same game in their own bases โ€” and the negabinary converter plays it in base โˆ’2, where even negative numbers need no minus sign.

Convert decimal to binary exactly โ€” negative numbers, fractions with repeating binary digits detected and bracketed, arbitrarily large integers, with hexadecimal and octal equivalents and worked division steps.

In decimal
13.625
โ€”
As an exact fraction
109/8
Binary digits
7
In hexadecimal
D.A
In octal
15.5
The place values at work

Each 1 in your number claims its power of two; each 0 declines. Add the claimed bars and you have the decimal value โ€” place value is the whole trick.

The expansion, place by place

The three-bit shortcut families: binary groups perfectly into octal (3 bits per digit) and hexadecimal (4 bits per digit), which is why programmers rarely read long bit strings raw โ€” 1101.101 chunks into D.A hex or 15.5 octal at a glance, no arithmetic required. The grouping works because 8 and 16 are powers of 2; decimal, stubbornly 2ยท5, never gets a shortcut.

Convert binary to decimal with exact fractions โ€” place-value expansion shown digit by digit, the value as a reduced fraction, and instant hexadecimal and octal equivalents.

โˆ’42 as an 8-bit two's complement
11010110
โ€”
Read as unsigned
214
One's complement
โ€”
Sign-magnitude
โ€”
This width holds
โˆ’128 โ€ฆ 127
The wraparound wheel, unrolled

Every bit pattern, read as unsigned (left to right) against its signed meaning: the top half counts up normally, then the cliff โ€” the next pattern after the biggest positive is the most negative. Your number is the glowing dot.

The recipe, worked out

Why two's complement won: sign-magnitude and one's complement both have two zeros (+0 and โˆ’0) and need special-case circuitry for subtraction. Two's complement has one zero, and addition just works โ€” the same adder circuit handles positives and negatives because the encoding is arithmetic modulo 2n. The price is the famous cliff: add 1 to the biggest positive and you land at the most negative, the overflow behind countless bugs โ€” including the original Y2K38 problem, when 32-bit Unix time runs off its cliff in January 2038.

Two's complement converter and lab โ€” negative decimals to binary at 4, 8, 16 and 32 bits, one's complement and sign-magnitude compared, unsigned reinterpretation, ranges, and the overflow wraparound.

The exact number stored for 0.1
โ€”
โ€”
Category
normal
Exponent (raw โ†’ real)
โ€”
Mantissa (hex)
โ€”
Storage error
โ€”
The gap between neighboring doubles

Floating point means the representable numbers spread out as they grow โ€” near 1 the gap is about 2ร—10โปยนโถ, but past 2โตยณ (~9 quadrillion) the gap exceeds 1 and whole integers start going missing. This is why money should never live in floats.

The anatomy, decoded

The most famous "bug" that isn't: 0.1 + 0.2 = 0.30000000000000004. Neither 0.1 nor 0.2 exists as a double โ€” the machine stores 0.1000000000000000055511151231257827โ€ฆ and 0.2000000000000000111022302462515654โ€ฆ, their exact sum lands between two representable doubles, and rounding picks the one that prints as 0.30000000000000004. Every step is correct; only the expectation was decimal. It's the repeating-binary tail from the first tab, arriving with a 53-bit haircut.

IEEE 754 double-precision anatomy โ€” sign, exponent and mantissa bits decoded, the exact decimal value actually stored, storage error, subnormals and specials, and why 0.1 plus 0.2 is not 0.3.

"Hi!" in binary
โ€”
โ€”
Characters
3
UTF-8 bytes
3
Bits
24
Fits in classic ASCII
yes
Each byte, weighed

The byte values behind the message โ€” classic ASCII lives below 128; anything taller is multi-byte UTF-8 at work (accents, symbols, emoji).

Character by character

The single most elegant bit in ASCII: uppercase and lowercase letters differ by exactly one bit โ€” bit 5, worth 32. 'A' is 01000001, 'a' is 01100001 โ€” so case-insensitive comparison is just ignoring one bit, a trick from 1963 still humming in every server. And a modern honesty note: one on-screen character isn't one byte anymore โ€” 'รฉ' takes two, 'โ‚ฌ' three, most emoji four (and some, like family emoji, are several characters glued together). The Characters and Bytes stats above will disagree the moment you type one.

Text to binary and binary to text via UTF-8 โ€” per-character code points and byte breakdowns, ASCII compatibility check, and the one-bit uppercase trick.