Search for a tool
Ternary Code (Base 3)

Tool for converting, calculating and manipulating numbers in ternary code (base 3): decimal ↔ base 3 conversions, arithmetic operations, fractions and ternary logic.

Results

Ternary Code (Base 3) -

Tag(s) : 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 'Ternary Code (Base 3)' tool for free! Thank you!

Ternary Code (Base 3)

Ternary to Decimal Converter





See also: Binary Code

Decimal to Ternary Converter








Ternary to Text Decoder

To convert text, use a letter-number relationship such as A=1, B=2, etc., or the ASCII code (A=65).

Answers to Questions (FAQ)

What is ternary (base 3)? (Definition)

Ternary (base 3) is a number system that uses three distinct symbols, usually $0$, $1$, and $2$, to represent numbers.

Each position in a ternary number corresponds to a power of $3$, allowing for the unique encoding of whole or fractional values.

What symbols are used in base 3?

The three standard base-3 symbols are 0, 1, and 2. Some systems use variants such as 1, 2, and 3 or A, B, and C.

In standard (ternary) base 3, the symbols are $ 0 $, $ 1 $ et $ 2 $.

In balanced ternary, the possible values are $ -1, 0, +1 $, which are often written as $ -, 0, + $, but also sometimes $ 0 $, $ 1 $ and $ T $.

What is balanced ternary code?

Balanced ternary code is a variant that uses the values ​​-1, 0, +1, allowing negative numbers to be represented without a separate sign.

This is not a simple replacement of 0, 1, and 2 with -1, 0, and 1; a different mathematical transformation must be applied.

What is the method for converting a number to base 3?

To convert an integer (base 10 decimal) $ N $ to base 3, successively divide $ N $ by $ 3 $ and note the remainders (which are $ 0 $, $ 1 $, or $ 2 $).

Repeat until you obtain a quotient of zero. The remainders, read from bottom to top, give the base-3 representation.

Example: $ 42_{(10)} = 1120_{(3)} $

How to convert a negative decimal number to base 3?

Convert the absolute value of the number to base 3, then add a minus sign - in front of the result.

Using balanced ternary code allows you to encode negative numbers without a minus sign.

What is the method for converting a ternary number to base 10?

To convert a number from base 3 to base 10, multiply each digit by 3 raised to the power of its position (starting from 0 on the right) and add the results.

Example: $ 1120_{(3)} $ becomes $ 1 \times 3^3 + 1 \times 3^2 + 2 \times 3^1 + 0 \times 3^0 = 42 $

Source code

dCode retains ownership of the "Ternary Code (Base 3)" source code. Any algorithm for the "Ternary Code (Base 3)" algorithm, applet or snippet or script (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, breaker, translator), or any "Ternary Code (Base 3)" 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 "Ternary Code (Base 3)" or any other element are not public (except explicit open source licence). 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 "Ternary Code (Base 3)" and its results may be freely copied and reused, including for commercial purposes, provided that dCode.fr is cited as the source (Creative Commons CC-BY free distribution license).

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/ternary-code

In a scientific article or book, the recommended bibliographic citation is: Ternary Code (Base 3) on dCode.fr [online website], retrieved on 2026-03-25, https://www.dcode.fr/ternary-code

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 'Ternary Code (Base 3)' tool for free! Thank you!


https://www.dcode.fr/ternary-code
© 2026 dCode — The ultimate collection of tools for games, math, and puzzles.
 
Feedback