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.

Education & Math Calculator Runs in your browser Free · no ads

Customize your widget

Theme
Auto follows the visitor's light/dark setting.
Style
Attribution on your page
The widget is free; a visible credit is how you can say thanks. It is one plain line, shown in the code below, linking to the tool with rel="nofollow". Switch it off here or delete the line - the widget works the same either way.
More options

Live preview

Exactly what your visitors will see

Under the widget on your page: Basic Calculator by A2Z Tools

Embed code

<div data-a2z-widget="basic-calculator" data-height="560"></div>
<p class="a2z-attribution" style="margin:6px 0 0;font:12px/1.4 system-ui,sans-serif;opacity:.8">Basic Calculator by <a href="https://a2z.tools/embed/basic-calculator" target="_blank" rel="nofollow noopener">A2Z Tools</a></p>
<script async src="https://a2z.tools/embed.js"></script>

Recommended. A small script (what it does) sizes the widget to fit its content, loads it lazily and keeps it isolated in its own frame. Works in WordPress (Custom HTML block), Squarespace, Webflow, Shopify, Blogger, React / Next.js and plain HTML - anywhere a <script> tag is allowed.

Works with

Advertisement

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
  • Scientific Calculator

    Education & Math Calculator

    Trig in degrees or radians, logs, roots, powers, factorials, pi, e and Ans - typed or tapped.

    Get code
  • Percentage Calculator

    Education & Math Calculator

    X% of Y, X as a percent of Y, and the percentage change between two values.

    Get code
  • Fraction Calculator

    Education & Math Calculator

    Add, subtract, multiply and divide fractions and mixed numbers, with the simplified answer.

    Get code
  • Statistics Calculator

    Education & Math Calculator

    Mean, median, mode, range, variance, standard deviation and quartiles of any list of numbers.

    Get code
  • GPA Calculator

    Education & Math Calculator

    Credit-weighted GPA for a term, plus the new cumulative GPA when you add prior results.

    Get code
  • Final Grade Calculator

    Education & Math Calculator

    The score you need on the final exam to reach a target grade, plus best and worst cases.

    Get code

Preview

Advertisement