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
Optional and entirely your choice. The exact line is shown in the code below; it links to the tool with rel="nofollow".
More options

Live preview

Exactly what your visitors will see

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.

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