The guide
Writing numbers with no minus sign: how a base below zero carries the sign in its digits
In base -3 the number 146 is 21102 and -5 is 21, with no minus sign anywhere. The sign hides in how many digits there are, and one rule about remainders makes it work.
- 21102 146 written in base -3
- 9977 -8,163 written in base -10
- -170 to 85 numbers that fit in 8 negabinary digits
- 859 of 1 to 2,000 need two extra digits
- 1957 year of Pawlak and Wakulicz study
Read the full guide Fold the guide
Take the string 12243 and read it in base -10. The Wikipedia article on negative bases does exactly that. The places are worth 10,000, minus 1,000, 100, minus 10 and 1, so the digits give 10,000 minus 2,000 plus 200 minus 40 plus 3, which is 8,163. And the number minus 8,163 is written 9977. Neither string has a minus sign. That is the whole idea. A negative base is minus r for some whole number r of at least 2, and every whole number, positive or negative, gets a plain string of digits from 0 to r minus 1.
Where the sign goes
In an ordinary base the places are r to the first, second and third power, and every place adds. In base minus r the powers alternate: the ones place is worth 1, the next is worth minus r, the next is r squared, then minus r cubed. The places at odd positions subtract, and the places at even positions add.
Because of that, a digit string can only land on a negative number if its largest digit sits in an odd place. A string with an odd number of digits has its leading digit in an even place, where it adds, so it is not negative. A string with an even number of digits leads with a subtracting place. The Negative base article states the result: negative integers have an even number of digits and non-negative integers an odd number, with the exception of nega balanced ternary.
So the sign has not vanished. It has moved into the length. Count the digits and you know whether the number is below zero, a job that a sign bit or a minus sign does in other systems. The Signed number representations article lists the usual ways to give a computer a negative number, sign and magnitude, ones’ complement and two’s complement, and puts negative binary with base minus 2 among the methods that use an implicit sign.
Here is the cost. Ordinary notation for 5 is 101, and negabinary writes it 101 as well. Negabinary for 6 is 11010, though, where binary is 110. The Negative base article says the stored sign often makes a number one digit longer. Measured on the page over 1 to 2,000, negabinary needs the same number of digits as binary for 459 numbers, one more for 682 and two more for 859.
The remainder rule that trips people up
Conversion is repeated division by minus r. Divide, keep the remainder as a digit, carry the quotient on, and stop at zero. The digits are the remainders read from last to first. With a positive base this is easy. With a negative divisor there is a catch, and it is where hand work and quick answers go wrong.
Every digit must lie between 0 and r minus 1. The Euclidean division article states the rule behind this: dividing a by b gives a unique quotient and a unique remainder with 0 at most the remainder and the remainder below the absolute value of b, whatever the sign of b. Divide minus 5 by minus 3. The quotient must be 2 and the remainder 1, because 2 times minus 3 plus 1 is minus 5. The Negative base article spells out the two wrong answers: 3 remainder 4 and 1 remainder minus 2.
Most programming languages do not do this for you. The MDN article on the remainder operator says that in JavaScript the result always takes the sign of the dividend. The Modulo article explains the same split: some languages give a positive remainder even for negative divisors, and many give the dividend’s sign. A remainder of minus 2 as a digit is not a digit at all.
The repair is short. When the plain remainder d is below zero, add r to it and add 1 to the quotient. The Negative base article gives this as the fix for languages that truncate. The page applies it at every step and marks each step where a plain division would have given a remainder below zero, so you can see the repair rather than trust it.
Convert minus 13 to base -2. The first step divides minus 13 by minus 2. A plain division leaves remainder minus 1, so add 2 to get the digit 1, and the quotient becomes 7. Next, 7 gives remainder 1 and quotient minus 3. Then minus 3 gives plain remainder minus 1, which is repaired to digit 1 with quotient 2. Then 2 gives remainder 0 and quotient minus 1, minus 1 gives digit 1 with quotient 1, and 1 gives digit 1 with quotient 0.
Read the digits from the last step to the first: 110111. That is six digits, an even number, which is right for a negative number. Check it by place values. From the right the places are worth 1, minus 2, 4, minus 8, 16 and minus 32, and the digits give 1 minus 2 plus 4 plus 0 plus 16 minus 32, which is minus 13.
The same method turns 146 into 21102 in base -3, which is the example in the Negative base article. It also turns 1,000 into 10000111000 in base -2 and minus 12,345 into 193755 in base -10. Each of those came out of the page and was compared with an independent calculation.
Now the cheap mistake. Read 21102 with positive weights of 3, so that every place adds. You get 2 times 81, plus 27, plus 9, plus 0, plus 2, which is 200, not 146. The alternating signs are not decoration. They are what makes the string mean anything.
How many digits a number needs
A string of k digits can hold a whole range of numbers, and the range has a tidy formula. Odd places can only subtract and even places can only add, each by at most r minus 1 times a power of r. So the smallest number is minus (r minus 1) times the sum of r to the i over the odd i below k. The largest is (r minus 1) times the sum of r to the i over the even i below k. This is derived on the page, not copied.
Take base -2. One digit covers 0 to 1, two digits cover minus 2 to 1, three cover minus 2 to 5, and eight cover from -170 to 85. Notice that the range leans negative when k is even and positive when k is odd, which is the even and odd rule again.
The range is also unbroken. Every whole number from the smallest to the largest has a string of exactly k digits, with leading zeros allowed, and no two strings share a number. The page proves that for small cases by listing every string. Its self-check lists every string of up to 8 digits where the count allows it, in every base from minus 2 to minus 16, and the formula matched each list, with no gap and no repeat.
That is why the digit count of a number is the shortest length whose range holds it. Five digits in base -3 reach from minus 60 to 182, and four reach only minus 60 to 20. So 146 needs five.
Where negabinary has actually been used
Negative bases were first considered by Vittorio Grunwald in an 1885 monograph, as the Negative base article reports. They were mentioned in passing in 1936 and studied in more detail by Zdzislaw Pawlak and A. Wakulicz in 1957, in a paper about using such expansions in the arithmometer of a digital computer.
The same article says negabinary was implemented in the early Polish computer BINEG, built from 1957 to 1959, and in the UMC. The UMC article adds that the family was produced by Elwro from 1962, with a vacuum-tube UMC-1 and a transistor UMC-10 in 1964, all working in base minus 2. The two pages give different dates for the machines, and this essay reports both rather than choosing.
Since then, uses have been rare, but they exist. The zfp documentation describes a compressor for floating-point arrays from Lawrence Livermore National Laboratory that converts two’s complement integers to negabinary with one addition and one bit-wise exclusive or. Its stated reason: the leftmost one-bit in negabinary carries both the sign and the rough size, and small numbers have many leading zeros whatever their sign.
That single addition and exclusive or is a shortcut. The Negative base article credits it to Schroeppel, in a 1972 memo, and gives the C form: add 0xAAAAAAAA, then exclusive-or with it. The page’s self-check runs the shortcut for every number from minus 100,000 to 100,000 and compares it with the division method. It agreed every time. Two’s complement, by comparison, is described by its own article as the representation all modern computers use.
What this page does not do
It converts whole numbers only. Fractions in a negative base exist, and so do complex bases, but neither is covered here. It does not add, subtract or multiply inside a negative base, which is harder than in a positive one, as the Negative base article admits. And it leaves out signed-digit systems such as balanced ternary, where the base is positive and some digits are negative. The Non-standard positional numeral systems article describes balanced ternary as a positive base with negative digits, which is a different thing from a negative base.
A few limits are practical. The decimal input is capped at 300 digits and the base minus r string at 1,100, so every 300-digit number can come back through its own result. Numbers are held as BigInt, and the MDN article shows why: adding 2 to the largest safe integer of an ordinary number gives a wrong answer, while a BigInt stays exact. The comparison table, the listing of strings and the self-check run in a web worker, as the Web Workers API article describes, so the page stays responsive while they work.
The other limit is honesty about use. Negative bases are a curiosity with a few real niches. You will not need them for everyday work, and the Two’s complement article says modern computers use something else. They are worth knowing because they show how little a minus sign is really needed, and how much a rule about remainders can quietly decide.
Sources
Every source consulted for this guide. Links checked November 10, 2026.
- Negative base - Wikipedia Wikipedia (CC BY-SA 4.0)
- Positional notation - Wikipedia Wikipedia (CC BY-SA 4.0)
- Non-standard positional numeral systems - Wikipedia Wikipedia (CC BY-SA 4.0)
- Euclidean division - Wikipedia Wikipedia (CC BY-SA 4.0)
- Modulo - Wikipedia Wikipedia (CC BY-SA 4.0)
- Signed number representations - Wikipedia Wikipedia (CC BY-SA 4.0)
- Two's complement - Wikipedia Wikipedia (CC BY-SA 4.0)
- UMC (computer) - Wikipedia Wikipedia (CC BY-SA 4.0)
- Algorithm - zfp 1.0.1 documentation zfp project, Lawrence Livermore National Laboratory (BSD-3-Clause)
- Remainder (%) - JavaScript | MDN MDN Web Docs (CC BY-SA 2.5 or later)
- BigInt - JavaScript | MDN MDN Web Docs (CC BY-SA 2.5 or later)
- Web Workers API - Web APIs | MDN MDN Web Docs (CC BY-SA 2.5 or later)