A premium, responsive, feature-rich smart calculator web application built with HTML5, CSS3, JavaScript (ES6+) and Bootstrap 5.3. It combines a glassmorphism / neumorphism UI with a safe, self-contained math engine, modern animations, accessibility support and a full suite of everyday tools.
| Area | Capabilities |
|---|---|
| Basic | + − × ÷, percent, decimals, parentheses, negative numbers |
| Scientific | sin cos tan asin acos atan, √ ∛, squares/cubes/powers, ln log exp, factorial, absolute value, π & e, DEG / RAD modes |
| Memory | MC MR M+ M- MS (persisted to Local Storage) |
| History | Timestamps, live search, delete one / clear all, export JSON / CSV, copy, print, download |
| Keyboard | Numbers, operators, Enter, Esc, Backspace, Delete, arrow navigation, Ctrl+C/V, Ctrl+Z/Y, scientific shortcuts |
| Settings | Theme, font size, sounds, animations, shortcuts, auto-save / auto-clear history — persisted |
| Accessibility | Keyboard nav, focus rings, ARIA labels, screen-reader support, High-Contrast & Large-Font modes, reduced-motion support |
| Smart Tools | Unit converter, currency converter (Frankfurter API), percent, BMI, age, EMI loan, GST/VAT, date diff, random numbers, password generator |
| Voice | Voice input (Web Speech API) & spoken results (Speech Synthesis API) |
| UX | Animated loading screen, ripple & press effects, floating background, live result preview, auto-complete brackets, undo/redo, toast & SweetAlert notifications |
Themes: Dark / Light / High-Contrast — persisted automatically.
Because the app uses browser APIs (Clipboard, fetch-to-Frankfurter, Local Storage), a small local web server gives the smoothest experience:
# from the project root
npx serve .
# or
python -m http.server 8080
# then open http://localhost:8080You can open index.html directly by double-clicking it. The app works, but note:
- The Print History feature opens a new window with
about:blank(never the page URL) so it does not trigger Chrome'sfile://“Unsafe attempt to load URL” security warning. - Currency conversion needs internet access (uses the free Frankfurter API).
- CDN libraries (Bootstrap, GSAP, AOS, SweetAlert2, Toastify, icons) require an internet connection.
⚠️ Some browsers restrict Clipboard access onfile://. Use a local server for the full experience.
calculator_Js/
├── index.html # Main calculator single-page app
├── about.html # About the project
├── help.html # Help & keyboard shortcuts
├── assets/
│ ├── css/
│ │ ├── style.css # Core layout & components
│ │ ├── themes.css # Design tokens (light / dark / high-contrast)
│ │ ├── animations.css # Keyframes, ripple, loading, micro-animations
│ │ └── responsive.css # Mobile-first breakpoints
│ ├── js/
│ │ ├── theme.js # Theme apply/persist + global toggle (every page)
│ │ ├── settings.js # User preferences store + side-effects
│ │ ├── calculator.js # Safe math engine (tokenizer + parser)
│ │ ├── memory.js # MC/MR/M+/M-/MS memory hub
│ │ ├── history.js # History CRUD, search, export
│ │ ├── keyboard.js # Global keyboard shortcuts
│ │ └── app.js # UI controller / wiring / utilities
│ ├── icons/ images/ sounds/
└── README.md
Module namespace: all modules register under the global CalculatorApp object, e.g. CalculatorApp.calculator, CalculatorApp.history, CalculatorApp.memory.
assets/js/calculator.js implements a tokenizer + recursive-descent parser — it never uses eval() or new Function. It supports:
- Arithmetic, unary minus, implicit multiplication (
2(3+4),2pi,3sin(30)) - Right-associative power
^, postfix factorial!(with a Lanczos gamma approximation for non-integer input) - Degrees / radians for trigonometric & inverse functions
- Robust errors: division by zero, consecutive operators, unbalanced parentheses, overflow,
NaN/Infinity, unknown symbols
| Key | Action |
|---|---|
0–9 . + − * / ^ ( ) % ! |
Input |
Enter |
Calculate |
Esc |
Clear entry |
Backspace / Delete |
Delete / Clear all |
← → |
Move cursor |
Ctrl+C/V Ctrl+Z/Y |
Copy / Paste / Undo / Redo |
S C T Q R L P E M |
sin( cos( tan( sqrt( cbrt( ln( π e / toggle mode |
Scientific key toggle is M.
All settings live in Local Storage (calc_settings) and are applied instantly on index.html. The theme is stored separately (calc_theme) so it carries across all pages.
- Theme: navbar moon button cycles Dark → Light → High-Contrast.
- Font / animations / sound: toggle from the Settings panel or via user preference.
- History:
calc_historykey; memory usescalc_memory.
Modern evergreen browsers (Chrome, Edge, Firefox, Safari). Uses CSS custom properties, backdrop-filter, IntersectionObserver, and the Web Speech / Clipboard APIs with graceful fallbacks.
MIT — free to use and modify.