MathPencil calculator: add, subtract, multiply, and divide

0
MathPencil© 2026 HTPdevs

What MathPencil is for

MathPencil is a free printing adding machine for everyday arithmetic: receipts, invoices, measurements, a column of figures that has to come out right.

On a phone calculator a running total is one figure with no record behind it, so a lost place means keying the column again. Here every entry stays printed on the tape, and the figure already added is still on screen.

Made by HTPdevs. A formula with roots, powers or trigonometry in it belongs on the scientific calculator; an equation with a letter in it belongs on the pre-algebra solver.

How to use it

Working a sum step by step

Press numbers, operators and decimal points. Each operator resolves what is already standing and strikes it onto the tape, and = prints the total in red. Every step stays on the tape above, so a figure entered five lines back can be read rather than remembered.

Solving a sum that is already written down

Under the calculator, the Paste a sum box is where you can paste any non-algebraic equation. Paste (12 + 5) × 3 ÷ 2, press Enter or Solve, and it is answered in one go. It takes parentheses '()', thousands separators like 1,250 and whichever multiplication and negative characters your source happened to use: *, ×, x, and the long dashes word processors substitute for a hyphen.

Using the keyboard or the number pad

The keyboard drives the machine as fully as the mouse does, and the number pad works whether Num Lock is on or off, because key presses are read by physical key rather than by the character they produce.

0–9
Numbers. The top row and the number pad both work.
. or ,
Decimal point. Either character works.
+ − * x /
Operators. Both * and x multiply.
Enter or =
Total the sum and strike the answer onto the tape.
Backspace
Delete the last digit entered.
Delete or Clear
Clear the entry on screen and keep the sum going.
Escape
All clear. Tears off the tape and starts again.
%
Percent.
Tab, then Enter
Move focus from key to key, then press the focused key.

Advanced options

M+ / M−
Add the number on screen to the stored number, or take it off. A small orange lamp lights above the keypad whenever something is held.
MR / MC
Put the stored number back on screen, or empty the store. Memory is the one thing All clear leaves alone.
%
Converts rather than guesses. 25 × 20 % leaves 0.2 on screen and totals 5. After + or − it reads as a percentage of the running total, so 200 + 10 % is ten percent of two hundred.
√
Square root of the number on screen, struck onto the tape like any other step.
±
Flip the sign. Negatives print in red, the way a machine prints a credit.
⌫
Backspace, digit by digit, while a number is still being keyed.
C / AC
C clears the entry and leaves the sum standing. AC tears off the tape and starts again.

Long answers shrink rather than clip, and anything past twelve figures (or smaller than a millionth) prints in exponential form.

How does this work?

The keypad

The keypad is a state machine that behaves like an adding machine: pressing an operator resolves what is already standing and prints it, which is why 2 + 3 × 4 reaches 20. The tape shows exactly the route it took.

The paste field

Pasted text goes through a tokenizer and a small recursive-descent parser written by hand, with the ordinary grammar of written arithmetic: multiplication and division bind tighter than addition and subtraction, and brackets override both. It is a parser rather than a call to the browser's own expression evaluator. Anything the calculator does not accept comes back as a sentence explaining what is wrong with it, not as a wrong answer.

Where it runs

Everything runs from the browser. The pages themselves are rendered to plain HTML ahead of time and served as static files, so there is no server-side calculation and nothing to send a figure to. Rounding happens only at the moment of printing.

Advertising and your privacy

MathPencil is free, and advertising is what pays for it. Ads are served by Google AdSense, which may set cookies or read device identifiers to choose and measure them. Your calculations are never part of that: they stay in your browser and are not shared with any advertiser. The ads are not personalised: Google is told to treat MathPencil as a site children use. What is collected, and by whom, is set out in the privacy policy.