calced
A notepad calculator that evaluates math expressions in plain text files. Available as a CLI tool and a web app.
Why calced?
Spreadsheets are overkill for quick calculations. REPLs lose context once you close them. calced keeps your math in plain text files where results stay next to the expressions, files can be versioned and diffed, and you use whatever editor you want.
Compared to other notepad calculators:
- Tiny, no dependencies — the CLI is a single 47KB Python file (stdlib only), the web app is a single 52KB HTML file. No build step, no node_modules, no Electron.
- Works offline — both versions run entirely locally. Save the HTML file or install the CLI and you're set.
- Both CLI and web — same syntax, same test suite, but well adapted to each environment.
- Stable results — shared web URLs include the major version, so they won't break on updates. Files store results inline. All configuration is inside the documents.
Web
Open the web app in a browser.
CLI
calced <file> # evaluate and update file in place
calced -s <file> # print result to stdout (don't modify file)
calced -w <file> # watch for changes and auto-update
calced -w -s <file> # watch and print (clears screen on change)
calced -u <file> # print shareable web URL
Installation
Requires Python 3.9+. Any typical Python install method works (pip install calced, etc.).
# Install as a CLI tool
uv tool install calced
# Or run without installing
uvx calced <file>
# Or just grab the single-file script and run it directly
python calced.py <file>
How it works
Write math anywhere in a plain text file. Results are appended inline as # => result comments. Non-math lines are left untouched.
rent 1500 # => 1_500 │
groceries 200 + 150 # => 350 │
utilities 80 + 45 + 30 # => 155 │
total # => 2_005 ┘
Results are aligned and updated in place each time you run the CLI (or automatically in watch mode), or live as you type in the web app.
Features
Basic arithmetic
2 + 3 # => 5
10 * (4 + 6) # => 100
2 ^ 10 # => 1_024
17 % 5 # => 2
Variables
income = 5000 # => 5_000
tax_rate = 22% # => 0.22
tax = income * tax_rate # => 1_100
after_tax = income - tax # => 3_900
Percentages
50% of 300 # => 150
200 + 15% # => 230
200 - 10% # => 180
10 as % of 50 # => 20
SI prefixes
1k # => 1_000
1M # => 1_000_000
1.5G # => 1_500_000_000
500n * 2 # => 0.000001
Supported: k/K (kilo), M (mega), G (giga), T (tera), P (peta), E (exa), m (milli), u/μ (micro), n (nano), p (pico), f (femto), and more.
Unit conversions
5 km in miles # => 3.106855961
100 C in F # => 212
1 gib in mib # => 1_024
60 min in hr # => 1
1 gal in l # => 3.78541
Supported dimensions: length, mass, temperature, data, time, volume. Use in or to.
Rate conversions
Define exchange rates (or any conversion rate) with @rate, then convert using in.
@rate USD/EUR = 0.92
100 USD in EUR # => 92
50 EUR in USD # => 54.34782609
Functions
sqrt(16) # => 4
round(3.14159, 2) # => 3.14
min(5, 2, 8) # => 2
max(1, 9, 3) # => 9
log10(1000) # => 3
sin(0) # => 0
Available: sqrt, abs, floor, ceil, round, log, log2, log10, sin, cos, tan, asin, acos, atan, exp, min, max
Constants
pi * 2 # => 6.283185307
e ^ 1 # => 2.718281828
Date arithmetic
2025-01-15 + 3 days # => 2025-01-18
2025-01-31 + 1 month # => 2025-02-28
2025-03-01 - 2025-01-01 # => 59
Supports days, weeks, months, years. Subtracting two dates returns the difference in days. today, tomorrow, and yesterday work as keywords.
Totals
The total (or sum) keyword sums all numeric results since the last # heading or start of file.
rent 1500 # => 1_500 │
groceries 350 # => 350 │
utilities 155 # => 155 │
total # => 2_005 ┘
Blank lines are ignored in the total; headings reset it. Each total also resets the running sum, so consecutive totals act as subtotals:
food 300 # => 300 │
transport 100 # => 100 │
total # => 400 ┘
clothing 50 # => 50 │
total # => 50 ┘
total resolves to a value, so it works inside expressions and assignments:
100 # => 100 │
200 # => 200 │
300 # => 300 │
total * 2 # => 1_200 ┘
Number formats
Numbers can be written with commas or underscores as separators (1,000 or 1_000), in hex/binary/octal (0xFF, 0b1010, 0o77), or in scientific notation (1.5e3).
Trailing annotations
Parenthetical notes after an expression are ignored:
celo_price = 0.08 (see http://coinmarketcap.com) # => 0.08
Format directives
Control output formatting with @format and @separator directives. These apply to all subsequent lines until changed.
1000000 # => 1_000_000
@format = fixed(2)
1000000 # => 1_000_000.00
@format = scientific
1000000 # => 1.00e+06
@separator = comma
@format = minSig(3)
1000000 # => 1,000,000
Metadata
Release files for calced 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| calced-1.0.0.tar.gz | 19.7 kB | Without provenance | Details for calced-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| calced-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for calced-1.0.0-py3-none-any.whl |
Total release size: 44.9 kB
Release files / calced-1.0.0.tar.gz
| Download URL | calced-1.0.0.tar.gz |
|---|---|
| Size | 19.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f388a239f61cae82b7d62e7f9834e0d87f9ecdb355e51480cfd7248cb3da8c9f
|
|
BLAKE2b-256 checksum How to use checksums |
a98a196317e78f95702e56d7b845eb14ff60a11d76f189883f5b0991d32c88cd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / calced-1.0.0-py3-none-any.whl
| Download URL | calced-1.0.0-py3-none-any.whl |
|---|---|
| Size | 25.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d83db8cef21eda83f97f1385a25e3d4da9f2cbca13cc257cb172c474bdd37d99
|
|
BLAKE2b-256 checksum How to use checksums |
82ff20ed1fd6d32df44a6d0719fae7fb4d5f1cfba6b47be17933578e7df46ba5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for calced 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.