Terminal Calculator is a keyboard-first calculator for engineering and programming. Type the expression you want to evaluate, use the last result in the next calculation, and keep useful definitions in your workspace.

Quick start

Open Free Web to start without installing anything. In Desktop or Free Web, type in the expression box. The preview appears as you type; press Enter to commit the calculation and add it to the transcript. If you already have tcalc installed, run tcalc for the interactive terminal interface.

6*(1+6

Result: 42. At the end of an otherwise complete expression, the calculator can supply missing closing parentheses or square brackets. It does not repair a mismatched bracket or a missing operand.

Operators, functions and precedence

The table starts with the weakest binding. Use parentheses when the order matters to a reader. Comparisons return 1 or 0; && and || short-circuit.

Order, weakest firstOperators
Conversion->
Logic||, then &&
Bitwise|, then @ (XOR), then &
Comparison, then shifts== != < <= > >=; << >>
Arithmetic+ -, then * / % and implicit multiplication
Signs, powers, factorialUnary + -, then ^, then postfix !

-2^2 gives -4; 2^3^2 gives 512 because powers group from the right. Try sqrt(9) for 3. Common scientific functions include roots, logarithms and trigonometry; see the built-in function reference for the complete catalog. The ^ operator is power, not XOR.

Number bases and bit operations

Use 0b for binary and 0x for hex, even if the display is decimal. Select BIN, DEC or HEX in the toolbar, or enter a display command:

display hex
0x2C | (1 << 4)

Result: 0x3C. This sets bit 4, counting from zero. Enter display dec to switch back. Bitwise operations require integers; fractions still display in decimal. Two’s-complement output, when enabled, uses the selected word width.

Binary and hexadecimal input can include a radix point:

0b101.11   # 5.75
0xA.F      # 10.9375
-0xA.F     # -10.9375

Use a dot for the radix point, including European decimal mode. Hex digits may be uppercase or lowercase. At least one digit is required on either side: 0b.1 and 0xA. are valid. Prefixes remain 0b and 0x. Separate units with a space. This extends input only: fractional answers still display in decimal when BIN or HEX is selected, and bitwise operations still require an integer value. 0xA.0 & 0b11 is valid; 0xA.F & 1 is not. Invalid digits or repeated points such as 0b10.2, 0xA.G and 0x1.2.3 are errors. Prefixed fractions do not use exponent or SI-suffix notation.

Units and conversions

10 in->cm
0.1 in->mm
ans * 19

Results in order: 25.4, 2.54, 48.26. A conversion returns a number in the requested unit. In the last line, the millimeters come from the context: 19 gaps at 2.54 mm per gap. Incompatible dimensions give an error. Use a space between the number and unit; 100k is a numeric prefix, not a unit expression.

Define a custom unit with unit pitch = 2.54 mm; then 19 pitch->mm gives 48.26. The scale must be positive. For USD amounts, $84+$36 gives $120. Multiply or divide a dollar amount by a scalar, not another amount; currency is not a physical unit or a currency exchange service.

Variables, functions and the previous answer

Use = to assign a value and == to compare. Variable and unit names are case-sensitive. ans is the last successfully evaluated value; a preview or failed expression does not replace it.

v = 3.3
r = 220
v / r * 1000
area(w,h) = w * h
area(4,5)

Ohm’s law gives 15 mA; the last line gives 20. Use the Variables and Functions panels to inspect and manage definitions, or :vars and :functions in the terminal.

Display and precision

Calculation precision and display precision are different. Set calculation precision from 16 to 1,000 digits, then choose how many significant figures to display. Display changes do not change stored numbers. Integers are exact within the calculator’s size limit; real-number arithmetic is rounded, not symbolic.

precision 100
sigfigs 30
sqrt(2)

Displayed result: 1.41421356237309504880168872421. Preferences also control notation, degree/radian mode, grouping and other display settings. European mode uses a decimal comma and semicolons between function arguments.

Desktop history, sessions and preferences

For a second Desktop workspace window, use Preferences → New window. For edge docking, enable Snap to screen edges in Desktop preferences, then drag to an edge. An unpinned docked window can hide and reappear when you move the pointer to the edge; a pinned one stays visible. In Appearance, choose System, Dark, Light, Contrast or Custom. Desktop preferences can also set window opacity. Use File → Recent Sessions to reopen a saved workspace.

Terminal commands and scripts

tcalc opens the interactive terminal UI; tcalc --plain uses simple prompts. In the terminal UI, Tab completes names, Up/Down recall history, Ctrl+R searches history, and Ctrl+Q quits. One-off commands run directly in your shell:

tcalc --no-state -e '10 in->cm'
tcalc --no-state -e 'sqrt(2)' --json

The first prints 25.4. JSON mode emits structured results. Quote shell expressions, especially those containing $, !, | or parentheses. --no-state leaves session and theme files alone; --state FILE selects a separate session state file.

Useful interactive commands

CommandWhat it does
:help, :settingsShow help or current settings.
:vars, :functions, :units, :historyInspect definitions, units or history.
:open PATH, :save PATHLoad or save the script buffer. Loading does not run it.
:run PATH, :export PATHRun a script or export successful history as a script.
:set sigfigs 30, :theme contrastChange terminal display settings or theme.
:license, :quit, :qCheck license status or exit.
:license activate CODE, :license import PATHActivate a short code or import a signed authorization file in builds that support it.

:set KEY VALUE exposes precision, sigfigs, decimal_places, base, angle, notation, thousands, european, twos_complement, word_bits and history_limit. Use true or false for switches. :theme accepts dark, light or contrast.

To run a script from your shell, save these lines as sample.script:

# Suppress output for the assignment
a = 7;
a * 6

Run tcalc --no-state sample.script to get 42. Add -o results.txt for a file or --json for structured output. A semicolon suppresses the preceding result; a # starts a comment. Calculator scripts do not execute operating-system commands.

Edition differences and licensing

Desktop and Terminal have a 30-day full-feature trial; basic arithmetic remains after the trial. In builds with activation, a short code needs internet for the initial exchange. After activation, calculations work offline. You can also import a signed authorization file offline. See the product page for current license terms.

Activation and signed authorization files

In a Desktop build with activation, choose ? → Enter License Key. Enter your issued short code and choose Activate License while online. For a signed file, use Import authorization file… and select your .tcalc-license file. In Terminal, use the commands below with your own code or file path. Import does not need internet. The app verifies the signature; do not edit the authorization file. Older local builds may not show these options.

:license activate CODE
:license import /path/to/license.tcalc-license

Troubleshooting

Reference

These tables describe the current source. A build labeled 0.2.2 may not include later changes, notably short-code activation and license-file import. The Free Web app does not use native licensing.

Built-in functions

The function catalog lists the 21 names below. Each takes one argument except mod, which takes two. There are no optional arguments. Function names are case-insensitive.

SignatureMeaningExample and result
sqrt(x)Square rootsqrt(9) → 3
ln(x)Natural logarithmln(1) → 0
log(x)Base-10 logarithmlog(100) → 2
log2(x)Base-2 logarithmlog2(8) → 3
log8(x)Base-8 logarithmlog8(64) → 2
exp(x)Raise e to xexp(0) → 1
sin(x)Sinesin(0) → 0
cos(x)Cosinecos(0) → 1
tan(x)Tangenttan(0) → 0
asin(x)Inverse sineasin(0) → 0
acos(x)Inverse cosineacos(1) → 0
atan(x)Inverse tangentatan(0) → 0
sinh(x)Hyperbolic sinesinh(0) → 0
cosh(x)Hyperbolic cosinecosh(0) → 1
tanh(x)Hyperbolic tangenttanh(0) → 0
abs(x)Absolute valueabs(-7) → 7
round(x)Nearest integer; ties away from zeroround(-2.5) → −3
ceil(x)Round toward positive infinityceil(2.1) → 3
floor(x)Round toward negative infinityfloor(-2.1) → −3
rand(max)Random value from zero below positive max; zero if max is zerorand(0) → 0
mod(x,y)Remainder, like %mod(11,4) → 3

Angle mode affects ordinary and inverse trigonometry, not hyperbolic functions. The current evaluator also accepts logN(x) for integer bases N greater than 1; for example, log3(27) gives 3 even though log3 is not a catalog entry. rand samples only on submission. The built-in constants pi and e, and the reserved last result ans, cannot be redefined.

Calculator commands

These are the current calculation-language commands. Enter them without a colon. They are distinct from terminal UI commands; visual or session actions depend on the interface, and advanced operations can be restricted in Basic mode.

SyntaxAction
clear, clsRequest a clear of the visible transcript.
del NAME, rem NAMERemove a user definition; all removes variables, functions and custom units.
disp NAMEShow a variable or ans.
display dec|hex|binChange the output base.
echo TEXTPrint text.
european on|offSwitch decimal and function-argument delimiters.
exitRequest exit in the interactive terminal.
listList user-defined functions.
mode rad|degSet the angle mode.
scimode auto|never|always|eng|prefix|financeSet output notation.
sigfigs NSet displayed significant figures, up to the calculation precision.
precision NSet calculation precision from 16 to 1,000 digits.
unit NAME = QUANTITYDefine a positive custom unit without replacing built-ins.
helpShow calculator syntax help.

Shell options

OptionAction
-e EXPR, --eval EXPREvaluate one expression string instead of reading a script file.
-o FILE, --output FILEWrite output to a file.
--state FILEUse an explicit state file; incompatible with --no-state.
--no-stateDo not save or load session and theme preferences. Does not disable licensing.
--jsonStructured output for an expression, a script or piped input.
--plain, --tuiChoose plain prompts or the full-screen UI. --tui requires a TTY and cannot be used for batch input.
-q, --quietLegacy batch compatibility option; requires an expression or input file.
-h, --help; -V, --versionShow help or the reported version.
FILE, -, -- FILERead one script file, read standard input, or end option parsing before a file name.

Terminal interface keys

Questions or corrections? Email hi@doer.ee.