Skip to main content

Two's Complement Converter for Signed Binary

Signed decimal to two's complement binary and hex at 4, 8, 16, 32, 64 bits, with sign-magnitude and one's-complement steps, runs in your browser

  • Runs locally
  • Category Developer & DevOps
  • Best for Formatting, validating, shrinking, or inspecting code-adjacent text.
Bit width:
Direction:

Signed range (8-bit): -128127

Binary (8-bit)
10000000
Hex
0x80

How it is derived

Sign-magnitude10000000
One’s complement (flip)01111111
Two’s complement (+1)10000000

All math runs locally on BigInt, so 64-bit values stay exact. Nothing is uploaded.

What this tool does

Free two's complement converter for computer science class, embedded firmware and low-level debugging. Type a signed decimal and read the exact two's-complement bit pattern at 4, 8, 16, 32 or 64 bits, plus the matching hex. So -1 at 8 bits is 11111111 (0xFF), -128 is 10000000 (0x80), and 127 is 01111111 (0x7F). Go the other way too: paste a binary word and the tool reads it back as a signed decimal under the bit width you picked, so 11111111 at 8 bits is -1, not 255. Every conversion shows the three-step derivation a textbook uses: sign-magnitude, one's complement (flip every bit), then add one. When a number falls outside the signed range for the chosen width the tool says so instead of silently wrapping, because -129 simply does not fit in 8 bits. One-click copy on each output. Everything is plain client-side JavaScript, nothing is uploaded and the math uses safe integer handling so 64-bit values stay exact.

Tool details

Input
Text + Numbers
The page exposes text boxes, numeric controls, file pickers, or structured inputs depending on the tool.
Output
Live result + Copy
The result area focuses on usable output, with copy, download, or preview actions when supported.
Privacy
Browser-side processing
The main tool logic does not call an external API, so inputs normally stay in the current tab.
Save / share
Shareable URL state
Key settings are encoded in the URL so another person can reopen the same setup.
Performance budget
Initial JS <= 9 KB
No WASM budget is declared, keeping the tool quick to open on mobile.
Best fit
Developer & DevOps · Developer
Category and role tags drive related tools, internal links, and quick fit checks.

How to use

  1. 1. Input

    Paste or drop your content into the tool panel.

  2. 2. Process

    Click the button. All processing is local in your browser.

  3. 3. Copy / Download

    Copy the result or download to disk in one click.

How Two's Complement Converter fits into your work

Use it in the small gaps between coding, reviewing, debugging, and shipping.

Developer jobs

  • Formatting, validating, shrinking, or inspecting code-adjacent text.
  • Preparing snippets for documentation, tickets, commits, or handoff.
  • Checking a small payload quickly without switching tools.

Developer checks

  • Run irreversible transforms like minify or obfuscate on a copy.
  • Keep secrets out of pasted snippets unless the tool explicitly stays local.
  • Use your normal tests or linter before shipping transformed code.

Good next steps

These links move the current task into a more complete workflow.

  1. 1 Number Base Converter Number base converter — binary, octal, decimal, hex, and any base 2-36. Bitwise too. Open
  2. 2 IP to Decimal Converter IPv4 dotted-quad to 32-bit integer, binary and hex, both directions, browser-only Open
  3. 3 Scientific Notation Converter Plain ⇄ scientific (a×10ⁿ) ⇄ engineering ⇄ E-notation — with significant figures, exact big/small numbers — browser-only Open

Real-world use cases

  • Check a CS homework answer step by step

    Your assignment asks for -37 in 8-bit two's complement and you got 11011011. Type -37, pick 8 bits, and the tool shows 37 as 00100101, the one's complement 11011010, and after adding one 11011011 (0xDB). Now you can see exactly which step you got right and which you fumbled, instead of just being told the final answer is wrong. The three-row derivation is the same method your professor grades, so a match here means full marks.

  • Read a raw register value off a debugger

    Your debugger shows a status register as 0xFF80 in a 16-bit field and you need the signed meaning. Switch to binary-to-decimal, paste 1111111110000000, set 16 bits, and read -128. Without fixing the width you might misread it as 65408 and chase a phantom bug. The tool pins the interpretation to the register size so the number you report in the bug ticket is the number the hardware actually holds.

  • Size an integer field before you commit to a struct

    You are laying out a packet struct and a temperature reading can go to -40. Is int8 enough? Enter -40 at 8 bits: it fits as 11011000. Try the worst case -200 at 8 bits and the tool flags it out of range, telling you int8 tops out at -128 and you need int16. Five seconds here saves a field-overflow bug that would only surface on the coldest day in production.

  • Teach the sign bit without a whiteboard

    Demonstrating to a class why 10000000 is -128 and not 128, you set 8 bits and type both 128 and -128. 128 overflows the signed range and gets flagged, while -128 lands exactly on 10000000. Flip to a positive 127 and it shows 01111111, one short of the negative reach. The side-by-side makes the asymmetry of the signed range concrete in a way a static slide never does, and the URL re-opens the same demo.

Common pitfalls

  • Reading a binary word as unsigned when the context is signed. 11111111 is 255 unsigned but -1 in 8-bit two's complement. Always fix the bit width first, then decide signed or unsigned, because the same digits mean two different numbers.

  • Forgetting the add-one step and stopping at the one's complement. Flipping the bits of 5 (00000101) gives 11111010, which is -6 not -5. Two's complement is flip then add one, so -5 is 11111011. Skipping the plus-one is the single most common off-by-one in hand conversions.

  • Assuming the positive and negative ranges are symmetric. An 8-bit value goes down to -128 but only up to 127, not 128. Because zero occupies a slot on the positive side, the magnitude you can store as a negative is one larger than as a positive, which trips up range checks.

Privacy

Every step here, the sign-magnitude line, the bit flip, the add-one and the range check, is plain JavaScript running in your browser tab. No decimal, binary word or bit width is ever sent to a server and nothing is logged. The one thing to know: the shareable URL encodes your input and bit width in the query string, so a link pasted into chat will record those values in the recipient server's access log. For a value tied to confidential hardware, use the copy button and paste the text rather than sharing the URL.

FAQ

Tool combos

Folks in your role tend to reach for these alongside this tool.

Made by Toolora · 100% client-side · Updated 2026-06-14