Modern PWA scientific calculator + unit & currency converter. Pure HTML/CSS/JS. Zero dependencies. Works offline.
+−×÷%decimal, clear, backspace- Live expression preview while typing
- Full keyboard support
- Trig: sin, cos, tan (Degrees / Radians toggle)
- Log: log₁₀, ln (natural log)
- Powers: x², x³, xʸ
- √ square root · n! factorial · eˣ exponential
- Constants: π (pi), e (Euler)
- Brackets:
()· Power chain^ - Swipe gesture on mobile to switch Normal ↔ Scientific
- Stored in
localStorage— persists after refresh - Click any item to reuse result
- Animated sidebar panel
- Length, Weight, Temperature, Speed, Time, Area, Volume
- Real-time conversion · Swap button · Formula display
- Live rates via open.er-api.com (free, no key)
async/await+fetchwith proper error handling- Cached rates in
localStorage(4-hour cache) - Offline fallback with approximate rates
- Retry button on failure
- 14 currencies: USD, INR, EUR, GBP, JPY, AED, CAD, AUD, CHF, CNY, SGD, MYR, SAR, KRW
- Service Worker caches all assets
- Works fully offline after first load
- Installable on Android/iOS/Desktop
- Offline indicator banner
- Full
aria-labelon every button aria-liveregions on display outputaria-selected/aria-pressedstate- Focus-visible keyboard ring on all interactive elements
- Screen-reader announcements on results
- Neon glassmorphism dark theme
- Clean minimal light theme
- Dark/Light mode toggle (saved)
- Sound toggle (Web Audio API)
- Copy result to clipboard
- Error handling with auto-reset
| Screen | Behaviour |
|---|---|
| 📱 Mobile (≤ 580px) | Full-screen sidebar, scroll layout, swipe gestures |
| 📟 Tablet (≤ 860px) | Compact buttons, side panel |
| 🖥️ Desktop | Full fixed viewport, side-by-side history |
| 🖥️ Large (≥ 1440px) | Larger buttons and display font |
MasterCalc/
├── index.html ← Full SEO meta, JSON-LD, PWA links, accessible markup
├── manifest.json ← PWA manifest
├── sw.js ← Service Worker (cache-first offline strategy)
├── css/
│ └── style.css ← Full styles, CSS vars, dark/light, responsive
├── js/
│ └── app.js ← All logic — modular, no frameworks
└── README.md
# Option 1: Open directly (most features work)
open index.html
# Option 2: Local server (required for Service Worker / PWA)
npx serve .
# or
python -m http.server 5500git init && git add .
git commit -m "feat: MasterCalc scientific calculator PWA"
git remote add origin https://github.com/YOUR_USERNAME/MasterCalc.git
git push -u origin main
# Settings → Pages → Source: main / rootUpdate in index.html:
<link rel="canonical" href="https://YOUR_USERNAME.github.io/MasterCalc/" />
<meta property="og:url" content="https://YOUR_USERNAME.github.io/MasterCalc/" />| Key | Action |
|---|---|
0–9 . |
Digits |
+ - * / % ( ) ^ |
Operators |
Enter |
Calculate |
Backspace |
Delete last |
Escape |
Clear all |
P |
Insert π |
E |
Insert e (scientific mode) |
| Layer | Details |
|---|---|
| HTML5 | Semantic, ARIA, meta tags, JSON-LD structured data |
| CSS3 | Custom properties, grid, animations, @media queries |
| JavaScript | ES6+, async/await, fetch, localStorage, Web Audio API |
| PWA | Service Worker, manifest.json, cache-first strategy |
| API | open.er-api.com — free, no key |
- No DOM rebuild on mode switch — both calc cards always in DOM, toggled with CSS classes
- Modular JS — 16 named sections, no global pollution
- Safe eval — custom
Function()with character whitelist, not raweval() - Graceful API failure — cached rates → localStorage → hardcoded fallback
- ARIA throughout — live regions, pressed states, hidden panels
MIT — free to use, fork, and learn from.