Basic Calculator Widget
Add a simple, accessible calculator to any page. It follows the order of operations (2 + 3 x 4 = 14), handles percent the way phone calculators do, and works with both the on-screen keys and the visitor's keyboard.
Live preview
Exactly what your visitors will seeUnder the widget on your page: Powered by A2Z Tools
Embed code
<iframe src="https://a2z.tools/embed/w/basic-calculator" title="Basic Calculator by A2Z Tools" width="100%" height="560" style="border:0;width:100%" loading="lazy" allow="clipboard-write"></iframe>
A plain iframe. Works everywhere, including site builders that strip scripts. Adjust height if your content needs more room.
<div data-a2z-widget="basic-calculator" data-height="560"></div> <script async src="https://a2z.tools/embed.js"></script>
Adds a small script (what it does) that sizes the widget to fit its content, loads it lazily and keeps it isolated from your page's CSS.
Works with
How it works
Keys build an expression that is shown above the result. A small parser evaluates it with multiplication and division before addition and subtraction, left to right within each level - no eval and no rounding until the display. The result is shown to 12 significant digits so floating-point artefacts disappear, and the answer carries into the next calculation when you keep typing an operator. Division by zero is reported rather than shown as Infinity.
Calculation method
- Precedence: x and / before + and -, left to right within a level
- a + b% = a + a x b / 100 (200 + 10% = 220); a - b% = a - a x b / 100
- b% anywhere else = b / 100 (50 x 10% = 5)
- Display: 12 significant digits; exponent form outside 1e-9 to 1e15
Limitations
- No brackets, memory keys (M+, MR) or history tape; use the Scientific Calculator for bracketed expressions.
- The % key follows phone-calculator conventions, which differ from spreadsheet formulas (in a spreadsheet, =200+10% gives 200.1).
- Double-precision arithmetic: results are exact to about 15 significant digits and shown to 12.
Where publishers use it
- A quick-sum tool on a shop, invoice or quotation page
- Primary-school maths pages that teach the order of operations
- Company intranets and internal wikis that need a calculator without installing anything
- Recipe or DIY sites where readers scale quantities
Questions
Does it follow BODMAS / PEMDAS?
Yes for the operators it has: multiplication and division are done before addition and subtraction. 2 + 3 x 4 gives 14, not 20.
How does the % key work?
Like most phone calculators: after + or - it takes that percentage of the running total (200 + 10% = 220); after x or / it simply divides by 100 (50 x 10% = 5).
Can I use my keyboard?
Yes. Digits, + - * /, the decimal point, %, Enter for equals, Backspace to delete and Esc to clear all work while the widget has focus.
Why does 0.1 + 0.2 show 0.3 here when some programs show 0.30000000000000004?
Computers store decimals in binary, which leaves a tiny error. The widget rounds the display to 12 significant digits, which hides that artefact without affecting normal answers.
Cite or recommend this tool
If you reference this tool in an article, course or documentation, these formats are ready to copy. They are optional - nothing is added to your site unless you paste it.
A2Z Tools Basic Calculator https://a2z.tools/embed/basic-calculator
<a href="https://a2z.tools/embed/basic-calculator">A2Z Tools Basic Calculator</a>
[A2Z Tools Basic Calculator](https://a2z.tools/embed/basic-calculator)
Basic Calculator by A2Z Tools - https://a2z.tools/embed/basic-calculator
Related widgets
-
Trig in degrees or radians, logs, roots, powers, factorials, pi, e and Ans - typed or tapped.
-
X% of Y, X as a percent of Y, and the percentage change between two values.
-
Add, subtract, multiply and divide fractions and mixed numbers, with the simplified answer.
-
Mean, median, mode, range, variance, standard deviation and quartiles of any list of numbers.
-
Credit-weighted GPA for a term, plus the new cumulative GPA when you add prior results.
-
The score you need on the final exam to reach a target grade, plus best and worst cases.