How to use the Base 3 to Binary tool
- Type a ternary number, made of the digits 0, 1 and 2, into the Base-3 number box. Select Example to load 1200.
- Select Convert to evaluate the number.
- Read the binary value in the Result box. For 1200 it is 101101.
- Select Copy to keep the result, or Clear to convert a different number.
How base 3 to binary conversion works
Ternary is positional notation with three digits. From right to left the places are worth 1, 3, 9, 27, 81 and so on, each a power of three. A ternary digit is sometimes called a trit, by analogy with bit.
Three and two share no common factor, so trits and bits never line up. You cannot translate one trit at a time. The tool instead evaluates the number: it walks the digits from left to right, multiplying a running total by 3 and adding each digit. That method is known as Horner's rule. The finished total is then printed in base 2.
Worked example: 2101 in ternary
Expand 2101 by place value: 2 × 27 + 1 × 9 + 0 × 3 + 1 = 64. Sixty-four is a power of two, so its binary form is a 1 followed by six zeros. Running the same digits through Horner's rule gives the running totals 2, 7, 21 and 64.
2101 (base 3) = 2*27 + 1*9 + 0*3 + 1 = 64
64 (base 10) = 1000000 (base 2)How many bits a ternary number needs
One trit carries about 1.585 bits of information, the base-2 logarithm of 3. A ternary number with n digits therefore needs at most 1.585 × n bits, rounded up. The four-digit input 1200 becomes the six-bit 101101, and the largest three-digit value, 222, is 26, or 11010.
The input limit is 4,096 characters. A 4,096-digit input made entirely of 2s produces a result 6,493 bits long, which is the longest output this converter can give.
Standard ternary, not balanced ternary
This converter reads ordinary, unbalanced ternary with the digits 0, 1 and 2. Balanced ternary is a different system whose digits stand for -1, 0 and +1, usually written with symbols such as T, 0 and 1 or -, 0 and +. It was used by the Soviet Setun computer built at Moscow State University in 1958. Balanced ternary strings are not valid input here. For negative values in standard ternary, put a minus sign in front: -102 converts to -1011.
Invalid input and error messages
The parser stops at the first character it cannot use and names it in the error message.
- Any digit from 3 to 9 gives Invalid base-3 digit, followed by the digit.
- Spaces or line breaks inside the number, a plus sign and a decimal point are also invalid digits.
- An empty box, or a minus sign with nothing after it, gives Enter a base-3 whole number.
- Prefixes such as 0b or 0t are not accepted for ternary input.
Frequently asked questions
What digits are valid in a base 3 number?
Only 0, 1 and 2. If the input contains a 3 or any higher digit, the tool reports it as an invalid base-3 digit, because that value cannot appear in a single ternary place.
How do I convert ternary 1200 to binary by hand?
Multiply out the places: 1 × 27 + 2 × 9 + 0 × 3 + 0 = 45. Then write 45 as powers of two, 32 + 8 + 4 + 1, which is 101101. The tool gives the same answer.
Can I convert ternary to binary digit by digit?
No. Digit-by-digit conversion only works when one base is a power of the other, as with base 4 or hexadecimal and binary. For base 3 you have to compute the whole value and then rewrite it.
Are leading zeros a problem?
No. Leading zeros in the input are ignored in the value, so 0012 converts to 101, the same as 12. The binary result itself never has leading zeros.
Is there a size limit on the number?
The input can hold up to 4,096 characters, counting a minus sign if present. The conversion uses arbitrary-precision integers, so every digit of a large value is exact, with no floating-point rounding.