A retro-styled, fully keyboard-driven calculator built with vanilla JavaScript and CSS3 — no frameworks, no build step, no dependencies.
Operator precedence in action: 7 × 8 − 2 evaluates to 54, not 46.
- Operator precedence —
7 × 8 − 2correctly evaluates to54, not46. Powered by a small shunting-yard evaluator (noeval). - Calculation history — a running tape of previous calculations. Click any entry to reuse its result.
- Memory keys —
MC,MR,M+,M−with an on-screen memory indicator. - Full keyboard control — type digits and operators directly;
Enterfor=,Backspace,Escto clear. - Percent & sign toggle —
%and±. - Light / dark theme — toggle in the top-right; your choice is remembered via
localStorage. - Responsive — adapts from desktop down to mobile.
- Graceful errors — dividing by zero shows
Errorinstead ofInfinity. - Accessible — real
<button>elements, ARIA labels, and a live-region display.
| Key | Action |
|---|---|
0–9 |
Enter a digit |
. or , |
Decimal point |
+ - * / |
Operators |
x |
Multiply (alias) |
% |
Percent |
Enter or = |
Equals |
Backspace |
Delete last digit |
Esc or Delete |
Clear all |
It's a static site — just open index.html in a browser, or serve the folder:
# Any static server works. This repo ships a tiny zero-dependency one:
node server.js
# then open http://localhost:4600├── index.html # markup
├── css/style.css # theming (CSS custom properties) + layout
├── js/calculator.js # calculator engine (no dependencies)
├── fonts/ # self-hosted Digital-7 display font
└── server.js # optional local preview server
Plain HTML5, CSS3 (custom properties, grid, no vendor-prefix cruft), and ES5-compatible JavaScript. Originally written in 2013 with jQuery and rebuilt from scratch.
Contributions are welcome! Please read the contributing guide and code of conduct first.
Released under the MIT License.
