Converters

Binary Converter

Convert decimal to binary, hex and octal with real machine semantics — two's complement negatives, fixed word sizes, ASCII characters and the KiB against kB discrepancy that makes a 1 TB drive look small.

Binary Converter

Results recalculate instantly on every keystroke. Nothing you type is transmitted.

Value
Machine Word
Text
Binary
A bit pattern has no meaning on its own. The same eight bits are 255 unsigned and −1 signed — the word size and the sign convention are part of the answer.
Hex and Octal
Two’s Complement, Step by Step
What This Word Size Holds
As Text
How a Float Would Store It
Bytes: KiB Against kB
Reading the Pattern

What this result does not account for

  • Word sizes of 8, 16, 32 and 64 bits only.
  • 64-bit values beyond about 2^53 lose exactness because the arithmetic uses double-precision floats.
  • The float card shows 32-bit IEEE 754 single precision, not double.
  • Text encoding is by code point; full UTF-8 multi-byte sequences are described but not emitted byte by byte.
Zero-Server Execution Updated 11 Aug 2026 Reviewed by Sana Khalid IEEE-754 Double Precision

In short: Binary stores every value as bits, but a bit pattern means nothing until you know the word size and whether it is signed. In 8-bit two's complement, 11111111 is −1, not 255. Negatives are formed by inverting the bits and adding one, which is why the range is asymmetric: −128 to +127, one more negative than positive. And 1 KiB is 1,024 bytes while 1 kB is 1,000, a gap that reaches 9.05 % at the terabyte.

Formula

two’s complement: invert all bits, then add 1
signed range = −2n−1 … 2n−1−1    unsigned = 0 … 2n−1
1 KiB = 1,024 B    1 kB = 1,000 B    drift at TB = 9.9511 %

A bit pattern is meaningless without a word size and a sign convention. Both are inputs here, not assumptions.

Worked Example

  1. Take the magnitude. −5 → 5 → 00000101 in 8 bits.
  2. Invert every bit. 00000101 → 11111010.
  3. Add one. 11111010 + 1 = 11111011.
  4. Check the top bit. It is 1, so the value reads as negative.
  5. Verify. 11111011 unsigned is 251, and 251 − 256 = −5. ✓

Why your 1 TB drive shows 931 GB. Nothing has been lost and nobody is lying. The manufacturer counts in decimal, so one terabyte is 1,000,000,000,000 bytes exactly. Windows counts in binary but labels the result ‘GB’, dividing by 1,024 three times, and 1012 ÷ 1,0243 is about 931. The correct label for what Windows shows is GiB, the gibibyte, which the IEC defined in 1998 precisely to end this confusion — and which most consumer software still declines to use. The drift compounds with each prefix: 2.4 % at the kilobyte, 7.3742 % at the gigabyte and 9.9511 % at the terabyte. macOS and most Linux tools report decimal, so the same drive looks bigger there, which is a labelling choice rather than a difference in the hardware.

Strengths & Limits Of This Model

Where this engine is strong

  • Treats word size and sign as inputs rather than silent assumptions.
  • Shows the invert-and-add-one steps explicitly for negative values.
  • Uses a real IEEE 754 encoding and reports round-trip loss honestly.

Where it stops

  • Refuses out-of-range values instead of demonstrating wrapping.
  • Does not cover big-endian against little-endian byte order.
  • Arbitrary radix conversion belongs to the base converter.

Risk & accuracy notice. A bit pattern read with the wrong word size or sign convention gives a completely different number — 0xFF is 255 or −1 depending on nothing but interpretation.

Practical Use Cases

Reading a negative value in a debugger

0xFFFFFFFF is −1 as a signed 32-bit integer and 4,294,967,295 unsigned — the pattern alone does not tell you which.

Choosing a word size

Confirming that a value fits before it silently wraps at run time.

Understanding character encoding

Seeing that upper and lower case differ by a single bit.

Explaining drive capacity

The KiB against kB gap — pair with the Data Storage Converter for full prefix conversion.

Methodology & Editorial Standards

Negative values use two's complement, computed as the value plus two raised to the word size, which is exactly what hardware does. The signed range runs from minus two to the power of n minus one, up to two to the power of n minus one, less one; the asymmetry is real and is reported rather than smoothed over. Out-of-range values are refused with an explanation instead of being silently wrapped, since silent wrapping is precisely the bug this page exists to illustrate. The float card uses a genuine IEEE 754 single-precision encoding through a DataView rather than a simulation, and reports the value read back so that loss of exactness above two to the twenty-fourth is visible. ASCII interpretation covers code points 0 to 127, with 32 to 126 printable; text input is encoded by code point, and the card states whether the string is plain ASCII or requires multi-byte UTF-8. Binary and decimal byte prefixes are treated as the distinct units they are, following IEC 80000-13. All conversion factors are exact by definition under the International System of Units, or exact by international agreement where the unit is defined by treaty. Values are held at full IEEE-754 double precision internally and rounded only for display, so chained conversions do not accumulate drift.

Computation runs in IEEE-754 double precision at full internal precision; rounding to two decimal places occurs strictly at the display layer, so no cumulative drift enters the result. All monetary outputs use accounting presentation — grouped thousands, two decimals, negatives in parentheses — so figures can be transcribed directly into a model or working paper. Division-by-zero and out-of-domain inputs return an em-dash rather than a misleading number.

This engine was reconciled against an independent reference implementation and hand-verified for the worked example above before release. Our full five-stage review process is published on the About Us page.

Sana Khalid Principal Front-End Engineer · ApexConverter

SI metrology and unit-system conversion accuracy. Last reviewed: 11 August 2026.

Disclaimer. This calculator is provided for informational and modelling purposes only and does not constitute financial, tax, legal, medical, or engineering advice. Verify all figures with a qualified professional before acting on them.


Binary Converter — 8 Expert FAQs

8 analyst-written answers to the questions practitioners actually ask — optimised for voice and answer-engine retrieval.

What is −5 in binary?

In 8-bit two's complement, 11111011. Take 5 as 00000101, invert every bit to get 11111010, then add one. The leading 1 marks it negative. In 16 or 32 bits the same value is written with more leading ones, so the pattern depends entirely on the word size — there is no single binary representation of −5.

Why is the signed range asymmetric?

Because zero takes a slot on the positive side. An 8-bit signed byte has 256 patterns to allocate: one for zero, 127 for positives and the remaining 128 for negatives, giving −128 to +127. A real consequence is that negating the most negative integer overflows back to itself, since +128 has no representation in a byte.

What is two's complement and why not just use a sign bit?

Sign-and-magnitude seems simpler but creates two zeros, positive and negative, and needs separate circuitry for subtraction. Two's complement has exactly one zero and lets the same adder handle both signs with no special case: subtracting is adding the complement. That hardware simplicity is why essentially every processor uses it.

Why does my 1 TB drive show as 931 GB?

Because two different definitions of the prefix are in play. The manufacturer means 10^12 bytes; Windows divides by 1,024 three times and still writes GB, when it should write GiB. Both count the same bytes. The gap is 9.9511 % at the terabyte and grows with every prefix step. macOS and Linux generally report decimal, so the drive looks larger there.

What is the difference between KB, KiB and Kb?

KB usually means 1,000 bytes and KiB always means 1,024 bytes. The lower-case b is the important one: Kb is kilo BITS, an eighth of the size. Internet connections are sold in bits per second and files are measured in bytes, which is why a 100 Mbps line downloads at about 12.5 MB per second rather than 100.

How does ASCII relate to binary?

Each character is a number, and that number is stored in binary. Capital A is 65, or 01000001; lower case a is 97, or 01100001. They differ by 32, a single bit, which is why case conversion is historically just a bit flip. ASCII defines 0 to 127 and uses only seven of the eight bits in a byte.

Why can't a float store 0.1 exactly?

Because one tenth does not terminate in binary. Ten has prime factors 2 and 5, and binary only offers 2, so the expansion repeats forever and must be truncated. IEEE 754 stores the nearest representable value, which is why 0.1 + 0.2 comes out as 0.30000000000000004. Integers below 2^24 in a float32, or 2^53 in a float64, are stored exactly.

How many bits do I need for my value?

Enough that the value fits the range shown for that word size. Eight bits hold 0 to 255 unsigned, sixteen hold up to 65,535, thirty-two up to about 4.29 billion and sixty-four up to roughly 1.8 times 10^19. Signed halves the positive maximum. Choosing too small a type and letting it wrap silently is one of the oldest bugs in computing.

Related Converters Engines