Binary to Negabinary Converter

Converts an ordinary non-negative binary number to base -2 (negabinary) by repeatedly dividing its decimal value by -2 and adjusting each remainder to be 0 or 1, so the result needs no separate sign bit even for negative source values. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-27

Overview

Introduction

Negabinary is an unusual but genuinely useful positional numeral system that uses base -2 instead of the ordinary base 2, letting alternating digit positions contribute positive and negative weights.

This tool converts an ordinary non-negative binary value into its negabinary equivalent using exact BigInt arithmetic.

What Is Binary to Negabinary Converter?

A base-conversion utility that reads an ordinary binary string, computes its decimal value, and re-expresses that value in base -2 (negabinary).

Negabinary digits are still just 0 and 1, but each digit's positional weight alternates in sign: position 0 is worth 1, position 1 is worth -2, position 2 is worth 4, position 3 is worth -8, and so on.

How Binary to Negabinary Converter Works

The binary input is validated and parsed as an exact BigInt decimal value.

That value is then repeatedly divided by -2. BigInt's truncating division can produce a negative remainder in base -2 arithmetic, so whenever that happens, 2 is added to the remainder and 1 is added to the quotient, keeping every digit a valid 0 or 1. The digits emerge least-significant-first during this process, so they're reversed at the end to produce the final negabinary string.

When To Use Binary to Negabinary Converter

Use it when studying or teaching negative-base numeral systems, which are a favorite example in computer science courses covering unconventional radix representations.

It's also useful for exploring signed-number representation schemes that avoid a dedicated sign bit.

Features

Advantages

  • Exact BigInt arithmetic with careful remainder correction, avoiding the off-by-one errors that a naive base -2 conversion can introduce.
  • Clear, deterministic algorithm that matches the standard mathematical definition of negabinary.
  • Instant, fully client-side conversion.

Limitations

  • Only converts non-negative binary input; it doesn't accept a decimal minus sign directly.
  • The output isn't zero-padded to a fixed width, so consecutive results can have different lengths.

Examples

Converting binary 1010

Input

1010

Output

11110

Binary 1010 is decimal 10. Negabinary 11110 decodes as 0×1 + 1×(-2) + 1×4 + 1×(-8) + 1×16 = 10, confirming the conversion.

Converting binary 1100

Input

1100

Output

11100

Binary 1100 is decimal 12. Negabinary 11100 decodes as 0×1 + 0×(-2) + 1×4 + 1×(-8) + 1×16 = 12, confirming the conversion.

Best Practices & Notes

Best Practices

  • Always verify a hand-derived negabinary example by decoding it back through its alternating positional weights before trusting it.
  • Use the Negative Binary Decoder if your goal is instead decoding a two's-complement signed binary string, which is a different representation from negabinary.

Developer Notes

Implemented with BigInt throughout: repeated division by BigInt(-2), correcting any negative remainder by adding BigInt(2) to the remainder and BigInt(1) to the quotient, per the standard negabinary conversion algorithm.

Binary to Negabinary Converter Use Cases

  • Teaching or exploring negative-base (non-standard radix) numeral systems
  • Demonstrating how a numeral system can represent signed values without a dedicated sign bit
  • Verifying custom negabinary conversion code against a precise reference implementation

Common Mistakes

  • Assuming ordinary base-2 division rules apply directly to base -2 — the remainder-correction step (adding 2 and incrementing the quotient) is essential and easy to omit.
  • Trusting a memorized negabinary value without decoding it back through alternating positional weights to confirm it.

Tips

  • Decode any negabinary result by hand using alternating positive/negative positional weights (1, -2, 4, -8, 16, ...) to double-check the conversion.
  • Compare with the Negative Binary Decoder, which handles the unrelated concept of two's-complement signed binary instead.

References

Frequently Asked Questions