Scientific calculator: trigonometry, logarithms, powers and roots

DEGShiftMMathPencil
0

Shift reaches the gold labels

Degrees

MathPencil SC© 2026 HTPdevs

What the scientific calculator is for

Some arithmetic is a list of figures to be added up. Some is a formula. This is the instrument for the second kind: trigonometry, logarithms, powers and roots, the constants π and e, and the brackets that hold a formula together. You build the whole expression in the window, read it back before committing to it, and then total it.

That makes it useful for homework and coursework, for a physics or chemistry problem set, for the kind of geometry that turns up in a workshop or on a building site, and for any figure you would otherwise have to work out in three separate steps and hope you transcribed correctly in between. Every calculation you strike stays listed above the live expression, so a chain of steps can be read back rather than remembered.

It is free, it needs no account, and it is made by HTPdevs. For a running total rather than a formula, the printing adding machine is the better instrument.

How to use it

Building an expression

Press keys in the order you would write the formula. A function key writes its own opening bracket. sin puts sin( on screen and waits for the angle. The running value sits under the expression in faint type as soon as what you have written makes sense; it is faint on purpose, because it is not an answer until you press =, which strikes it into the large line.

The shift key

Every key with a gold label above it has a second function behind Shift. Press Shift, then the key: the gold label drops into the key face so you can see what you are about to get, and the latch releases after one press. Shift lights in the window while it is held.

Degrees or radians

The mode is printed at the top left of the window and never hidden, because a trigonometric answer read in the wrong unit is not a small error. Switching it withdraws the struck answer rather than leaving a figure standing that the new mode would not produce.

Using the keyboard or the number pad

The keyboard works the moment the page loads. There is nothing to click into first. The number pad is read by key position rather than by the character it reports, so it keeps working with Num Lock off.

0–9
Write a digit. The main row and the number pad both work.
. or ,
Decimal point. Either character, because keyboards disagree.
+ − * /
Operators. Unlike the adding machine, x is a letter here, not a times sign.
Letters
Spell a function out: type sin(45) or log(1000) straight in. A word it does not know comes back as a sentence, not a wrong answer.
^
To the power of. 2^10 is 1,024.
( )
Brackets. Any left open at the end close themselves.
! and %
Factorial, and divide by a hundred.
Enter or =
Total. The answer is struck into the large line.
Backspace
Rub out the last key press, so sin( comes off in one.
Delete
Clear the expression, keep what is struck above it.
Escape
All clear. Memory and the angle mode survive.
Tab, then Enter
Move between keys and press the focused one.

Every key on the face

The same one-line notes are on the instrument itself: hover or focus any key and the browser shows what it does.

sin cos tan
Trigonometry, read in whichever unit the window shows, DEG or RAD. The shifted keys sin⁻¹, cos⁻¹ and tan⁻¹ go the other way, from a ratio back to an angle, and answer in the same unit.
ln log
Natural logarithm and logarithm to base ten. Shifted, they become eˣ and 10ˣ, the operations that undo them.
x² xʸ
Square, and raise to any power. Powers are right-associative and bind tighter than × and ÷, so 2^3^2 is 512 and −2² is −4, exactly as written arithmetic reads them.
√ ∛
Square root, and cube root behind the shift. A cube root takes negatives; a square root does not, and says so rather than printing a fault.
¹∕ₓ |x|
Reciprocal of what is already entered, and absolute value behind the shift.
π e
The two constants. Multiplication is implied next to them, so 2π is two pi and 3(4+1) is fifteen.
n! mod
Factorial, where 5! is 120, and behind the shift, the remainder after a division: 17 mod 5 is 2.
%
Divides by a hundred, and nothing more: 40% is 0.4, and 200 + 10% is 200.1. This is the one key that behaves differently from the adding machine on the home page, where % reads as a percentage of the running total.
Ans
The last answer struck, used as a figure inside a new expression. Pressing an operator straight after a total does this for you: the window shows Ans × 2.
MC MR M+ M−
The memory register. M+ and M− add and subtract the figure on screen; MR writes the stored number into the expression; MC empties it. An M lights in the window whenever something is held.
DEG / RAD
Switches the unit trigonometry is read in. Changing it withdraws the answer beneath, because the same expression means something else in the other mode.
AC / C
C clears the expression and leaves the calculations above it standing. AC clears the window entirely. Memory and the angle mode are settings of the instrument, so both survive.

How does this work?

What the keys build is text, and that text is read by a tokenizer and a recursive-descent parser written by hand. The grammar is the ordinary one: addition and subtraction at the bottom, multiplication, division and mod above them, powers above those and right-associative, then the postfix operations: !, %, x², and finally brackets, constants and functions. Multiplication next to a constant or a bracket is implied, so 2π and 3(4+1) read the way they are written.

It is a parser rather than a call to the browser's own expression evaluator on purpose. The ability to run arbitrary code is far too large a capability to hand a calculator, and a parser can explain itself: anything the grammar does not accept comes back as a sentence about what is wrong with it, not as a wrong answer.

In degrees, the quarter turns are answered exactly rather than left to a radian conversion: sin(180) is 0, not 1.22×10⁻¹⁶. Everything is rounded to twelve significant figures at the moment of printing, which hides binary floating-point noise while keeping far more precision than the work needs, and the full value is what Ans carries into the next expression.

The page itself is rendered to plain HTML ahead of time and served as a static file. There is no server-side calculation and nothing to send a figure to.

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.