Search for a tool
Négabinary

Tool to convert numbers with negabinary. The Negabinary system allows to represent positive and negative numbers without bit sign in a binary format (0 and 1) using the base -2.

Results

Négabinary -

Tag(s) : Informatics, Arithmetics

Share
Share
dCode and more

dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!
A suggestion ? a feedback ? a bug ? an idea ? Write to dCode!


Please, check our dCode Discord community for help requests!
NB: for encrypted messages, test our automatic cipher identifier!


Feedback and suggestions are welcome so that dCode offers the best 'Négabinary' tool for free! Thank you!

Négabinary

Negabinary to Decimal Converter



See also: Binary Code

Decimal to Negabinary Converter



See also: Base N Convert

Binary to Negabinary Converter



See also: Binary Code

Answers to Questions (FAQ)

What is negabinary? (Definition)

Negabinary writing corresponds to a base $ -2 $ numeral system.

How to convert a decimal number into negabinary?

The numbers in the negabinary system are described by the formula:

$$ \sum_{i=0}^{n}b_{i}(-2)^{i} $$

With $ b $ a bit and $ i $ its rank in the inverted negabinary development (ordered from the end to the beginning).

To convert an integer, it is enough to make a division repeated by $ -2 $ and to concatenate the obtained remainders starting with the end.

Example: 12 (decimal) in negabinary is written 11100 (its successive remainders are 0,0,1,1,1 :

12 / -2 = -6remainder 0-6*-2 = 12
-6 / -2 = 3remainder 03*-2 = -6
3 / -2 = -1remainder 1-1*-2 = 2 and 2+1 = 3
-1 / -2 = 1remainder 11*-2=-2 and -2+1 = -1
1 / -2 = 0remainder 10*-2 = 0 and 0+1 = 1

How to convert a Negabinary number to Decimal?

To convert a number from base $ -2 $ to base 10, apply numeric base change algorithms.

Example: 110 (negabinary) is equivalent to 2 (base 10) $ 1 \times (-2)^2 + 1 \times (-2)^1 + 0 \times (-2)^0 = 2 $

How to recognize a positive or negative integer in negabinary?

In nega-binary, negative integers(with a minus sign in base 10) have an even number of bits, while the positive integers(with a plus sign in base 10) have an odd number of bits.

Source code

dCode retains ownership of the "Négabinary" source code. Any algorithm for the "Négabinary" algorithm, applet or snippet or script (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, breaker, translator), or any "Négabinary" functions (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) or any database download or API access for "Négabinary" or any other element are not public (except explicit open source licence like Creative Commons). Same with the download for offline use on PC, mobile, tablet, iPhone or Android app.
Reminder: dCode is an educational and teaching resource, accessible online for free and for everyone.

Cite dCode

The content of the page "Négabinary" and its results may be freely copied and reused, including for commercial purposes, provided that dCode.fr is cited as the source. Exporting the results is free and can be done simply by clicking on the export icons ⤓ (.csv or .txt format) or ⧉ (copy and paste).
To cite dCode.fr on another website, use the link: https://www.dcode.fr/negabinary-system
In a scientific article or book, the recommended bibliographic citation is: Négabinary on dCode.fr [online website], retrieved on 2025-04-15, https://www.dcode.fr/negabinary-system

Need Help ?

Please, check our dCode Discord community for help requests!
NB: for encrypted messages, test our automatic cipher identifier!

Questions / Comments

Feedback and suggestions are welcome so that dCode offers the best 'Négabinary' tool for free! Thank you!


https://www.dcode.fr/negabinary-system
© 2025 dCode — The ultimate collection of tools for games, math, and puzzles.
 
Feedback