Free · Binary calculators 1️⃣0️⃣
One’s Complement Bit Converter
Convert signed integers and binary bit patterns in 2–70-bit one’s complement. See the flipped bits, symmetric range and negative-zero representation.
- Formula & worked example
- Private in your browser
- No signup
Calculator inputs
Loading calculator…
How to use this calculator
- Enter the known values in the units shown. Results update as you type.
- Where results are editable, change one to solve backwards. Lock a value to hold it fixed.
- Use the worked example to check the method. Reset restores the starting fields.
Private by default
Inputs and results stay in this browser tab. Bookify does not upload or store the values you enter.
Formula and method
Choose the width first. Positive integers use ordinary padded binary; negative integers invert each bit of their positive magnitude. All-one bits represent negative zero, while all-zero bits represent positive zero.
For w bits, M=2^(w−1)−1 and the signed range is −M through M. A negative pattern is the bitwise complement of its positive magnitude.
Worked example
Enter these known values and leave the other values blank.
- Binary number representation
- 4-bit
- Decimal
- -7
- Binary
- 1111
- Result
- -7 in 4-bit one's complement: 1000. Bitwise complement: 0111.
- Explanation
- 4-bit pattern 1111 represents −0 (negative zero; numerically zero). Bitwise complement: 0000.
Assumptions and limitations
- Choose 4,8,12,16,32 or64 bits, or Other for an integer width2 through70. The width determines the sign bit and signed range.
- Both converter directions can be used independently. Leading zeroes are optional; binary input permits only0 and1, not arithmetic or e notation. At most140 typed digits are admitted; meaningful digits must fit the width.
- Decimal arithmetic expressions are admitted only when every intermediate and final value is a provably exact finite decimal. The resulting integer must fit the selected width.
- One’s complement has two zero patterns. The all-one pattern is reported as negative zero, numerically equal to zero. Decimal−0 is encoded as positive zero because an ordinary numeric input does not retain a zero sign.
- The4-bit signed range is−7 to7. Unlike two’s complement,−8 is not representable. Inputs outside the selected range are rejected instead of wrapped or truncated.
Common questions
Why does1111 mean negative zero at4 bits?
The sign bit is1, and flipping all four bits gives0000. Its negative magnitude is zero, so1111 is the distinct negative-zero representation.
Is one’s complement the same as two’s complement?
No. One’s complement flips every bit; two’s complement also adds one. Their negative ranges and zero representations differ.
References
Translate the captured decimal/binary callbacks into exact bounded BigInt conversion, preserving both independent converter controls and original result tables. Correct the negative endpoint from −2^(w−1) to −(2^(w−1)−1), retain negative-zero bit patterns explicitly, and replace the Number/string-exponent digit-count workaround with exact canonical digit length. All five range/length numeric helpers are computed by the same bounded source-specific adapter; no captured JavaScript is executed. Bind this complete source/schema and raw capture to 2–70 bits, preserved 4/8/12/16/32/64 presets and Other width control. Decimal inputs must be representable integers; binary inputs are lexical 0/1 strings with at most 140 characters and significant length no greater than the selected width. Preserve bitwise-complement output, leading-zero padding, symmetric signed range guidance, and both original static converter tables. Publish bounded plain-text converter summaries for API access; explicitly distinguish negative zero. Numeric ranges/length are declared readonly exports, text exports cannot be numeric inputs. No truncation or arbitrary-length bit allocation is allowed.
Related calculators
Explore binary calculators 1️⃣0️⃣ or browse all math calculators.