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 first | Operators |
|---|---|
| Conversion | -> |
| Logic | ||, then && |
| Bitwise | |, then @ (XOR), then & |
| Comparison, then shifts | == != < <= > >=; << >> |
| Arithmetic | + -, then * / % and implicit multiplication |
| Signs, powers, factorial | Unary + -, 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
- Use History to find and reuse an expression; remove individual entries without clearing definitions. Use Copy on a result to copy its displayed value.
- Use the File menu to open or save a
.tcalcsession. Sessions carry history, transcript, input, scripts, definitions and settings. Opening a session does not execute its script. - Open the gear menu for Preferences. Set preview, precision and appearance there. Use the pin button for Always on top. Edge docking, tray access and global shortcuts depend on the operating system.
- On macOS Desktop, Ctrl+C clears focused calculation input; Cmd+C remains Copy. Windows and Linux Desktop use Ctrl+C for Copy.
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
| Command | What it does |
|---|---|
:help, :settings | Show help or current settings. |
:vars, :functions, :units, :history | Inspect definitions, units or history. |
:open PATH, :save PATH | Load or save the script buffer. Loading does not run it. |
:run PATH, :export PATH | Run a script or export successful history as a script. |
:set sigfigs 30, :theme contrast | Change terminal display settings or theme. |
:license, :quit, :q | Check license status or exit. |
:license activate CODE, :license import PATH | Activate 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
- Free Web: No account, trial or license. Load the site online; calculations run in the browser. Browser data is local, not synced. Use the browser File bar to export a
.tcalcbackup before clearing site data. Already loaded calculations run locally, but reopening or reloading offline is not supported. If another tab changes the same browser workspace, reload the stale tab before continuing. - Desktop: A native window with history, live preview and native window features where supported. macOS, Windows and Linux are desktop build targets; this manual does not provide installers.
- Terminal:
tcalcruns on macOS and mainstream Linux. Use the interactive UI for live preview, or use plain mode, one-off commands, pipes and batch scripts.
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
- Unexpected operator result: Add parentheses; remember that
^is power and@is XOR. - Unit conversion rejected: Check the dimensions and unit spelling. Use spaces around subtraction when a variable name also matches a unit.
- Only basic arithmetic works: Check the trial or license status in Desktop or with
:licensein Terminal. Free Web does not use that license. - Terminal state file is locked: Close the other process using it, or start with another
--statepath or--no-state. A leftover lock filename does not by itself mean the file is still locked. - Preview differs from submission: Preview does not write history, commit assignments or sample random functions. Enter submits the expression.
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.
| Signature | Meaning | Example and result |
|---|---|---|
sqrt(x) | Square root | sqrt(9) → 3 |
ln(x) | Natural logarithm | ln(1) → 0 |
log(x) | Base-10 logarithm | log(100) → 2 |
log2(x) | Base-2 logarithm | log2(8) → 3 |
log8(x) | Base-8 logarithm | log8(64) → 2 |
exp(x) | Raise e to x | exp(0) → 1 |
sin(x) | Sine | sin(0) → 0 |
cos(x) | Cosine | cos(0) → 1 |
tan(x) | Tangent | tan(0) → 0 |
asin(x) | Inverse sine | asin(0) → 0 |
acos(x) | Inverse cosine | acos(1) → 0 |
atan(x) | Inverse tangent | atan(0) → 0 |
sinh(x) | Hyperbolic sine | sinh(0) → 0 |
cosh(x) | Hyperbolic cosine | cosh(0) → 1 |
tanh(x) | Hyperbolic tangent | tanh(0) → 0 |
abs(x) | Absolute value | abs(-7) → 7 |
round(x) | Nearest integer; ties away from zero | round(-2.5) → −3 |
ceil(x) | Round toward positive infinity | ceil(2.1) → 3 |
floor(x) | Round toward negative infinity | floor(-2.1) → −3 |
rand(max) | Random value from zero below positive max; zero if max is zero | rand(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.
| Syntax | Action |
|---|---|
clear, cls | Request a clear of the visible transcript. |
del NAME, rem NAME | Remove a user definition; all removes variables, functions and custom units. |
disp NAME | Show a variable or ans. |
display dec|hex|bin | Change the output base. |
echo TEXT | Print text. |
european on|off | Switch decimal and function-argument delimiters. |
exit | Request exit in the interactive terminal. |
list | List user-defined functions. |
mode rad|deg | Set the angle mode. |
scimode auto|never|always|eng|prefix|finance | Set output notation. |
sigfigs N | Set displayed significant figures, up to the calculation precision. |
precision N | Set calculation precision from 16 to 1,000 digits. |
unit NAME = QUANTITY | Define a positive custom unit without replacing built-ins. |
help | Show calculator syntax help. |
Shell options
| Option | Action |
|---|---|
-e EXPR, --eval EXPR | Evaluate one expression string instead of reading a script file. |
-o FILE, --output FILE | Write output to a file. |
--state FILE | Use an explicit state file; incompatible with --no-state. |
--no-state | Do not save or load session and theme preferences. Does not disable licensing. |
--json | Structured output for an expression, a script or piped input. |
--plain, --tui | Choose plain prompts or the full-screen UI. --tui requires a TTY and cannot be used for batch input. |
-q, --quiet | Legacy batch compatibility option; requires an expression or input file. |
-h, --help; -V, --version | Show help or the reported version. |
FILE, -, -- FILE | Read one script file, read standard input, or end option parsing before a file name. |
Terminal interface keys
- Calculate: Enter submits; Alt+Enter inserts a line; Ctrl+C clears input; Ctrl+Q quits.
- Edit: Left/Right, Home/End, Backspace/Delete; Ctrl+A/E move to start/end; Ctrl+U/K delete to start/end; Ctrl+W deletes the preceding word.
- Find and navigate: Tab completes and cycles; Up/Down recall history; Ctrl+R opens history search, with Up/Down to select and Enter to recall; Page Up/Down scroll; Ctrl+L clears the visible transcript.
- Panels and scripts: F1 Help, F2 Variables, F3 Functions, F4 Units, F5 Settings; Esc closes a panel. Ctrl+O opens a script path prompt; Ctrl+S prompts to save the current input.
Questions or corrections? Email hi@doer.ee.