Paste from clipboard to calculator:
Paste and enter

Complex plot Real plot 2D plot

Inspect whole stack:


mobile mode (if off, f↓ and g→ labels can be clicked without the mode buttons)
horizontal mode
light mode (only works if browser supports changing CSS rules)
disable unit conversion buttons
disable scientific constant buttons
disable time and date buttons
disable integer and prime buttons


This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Welcome to the scientific programmable JavaScript calculator!

JSCalc aims to be an as complete, convenient and orthogonal possible calculator that does not have text. Features:

Hover with the mouse over each sub-section of a button to see an explanation of what it does. These are not explained in this manual but there instead.

Each button has up to 4 functions. Press the sub-section of a button with the mouse to perform that function.

The f↓ and g→ buttons only work in mobile mode (for small screens). In non-mobile mode, the individual labels of buttons can be pressed. f↓ accesses the bottom left function. g→ the top right function. Both combined accesses the bottom right function.

To paste a number from clipboard to the screen, use the paste input field below the calculator. Making the screen itself an input field and pasting in there does not play out well because the JavaScript calculator engine won't always recognize you changed the screen value that way since you didn't use any calculator buttons. Seperating this away into a separate input field with dedicated button clears away all confusion for both the user and the calculator. The input field is designed for pasting (CTRL+V), if you try to type numbers in here you'll notice the numbers appear in the calculator screen instead, because the number keys are already shortcuts for the number buttons of the calculator.

Keyboard shortcuts

A totally different type of shortcut is that you can click with the mouse on the indicators above the display to toggle these modes as well (where applicable).

The Hyp Shortcuts

There are some functions available that aren't labeled on the keys. These use the hyp modifier, normally used to modify sin, cos and tan into sinh, cosh and tanh.

The following ones are available:


Statistics and special memory register indices

The special negative memory indices can be read and written to, some allow a few extra features not found on any buttons Note: The statistics indices are in the beginning of the negative ones. Lower negative ones provide access to several flags and running parameters. Positive memory addresses with extra meaning:

Differences with typical calculators

Differences with typical RPN calculators

Stack convention

The stack has 8 (or optionally 4) elements. The three most recent ones have the following names: x, y, z. Here, x is the one being displayed, y is the second most recent, z is the third most recent.

In RPN, if you enter three values, then the order you entered them in is: "z, y, x". That means, you enter them in the opposite order than the expected "x, y, z". For that reason, for example, the power button is labeled "y^x" and not "x^y": this ensures you can enter that power in an intuitive order, first the base, then the exponent. However, for a few operators you must take care as the input is in opposite order compared to intuition: these are rectangular->polar, polar->rectangular, rectangular->spherical, and spherical->rectangular. For example as the input of rectangular->polar is x and y, you enter y first, then x. But most operations do have an intuitive order, e.g. for an integral you enter the start of the interval first, then the end. The smaller than operator is defined as "y < x". And the power operator was already described earlier.

In ALG mode, the naming is the same. But, as there is no reason to invert them, here you enter x first, then y, for rectangular->polar, spherical->rectangular, etc...

To view the result of a 3-result operation (that is, spherical<->rectangular), in RPN mode, just use R↓ 2 times to see all 3 results. In ALG mode, however, R↓ does not exist (it is open parenthesis instead). There is another way though: the second result can be seen with x↔y as in RPN. But the third result can be seen by first pressing 3, then HYP, then x↔y. That key combination mirrors the top 3 stack values, thereby bringing the 3th value to the screen.

Display modes

This calculator supports a lot of display modes. The precision modes automatic, fix, scientific or engineering, can be combined with any numerical base, complex numbers in rectangular or polar notation, and fraction or floating point notation. Any combination of these is possible.

The precision modes are:

If the base is another base than decimal (base 10), everything works exactly the same, except it uses the amount of digits for that base. The base is used for everything, including the exponent, angles of polar complex notation, etc... However, in any base other than 10, 'p' instead of 'e' is used for the exponential notation (Because e is a symbol in some bases)

E.g. the complex number that looks in decimal like 4.348606e23 i1.0072e23, looks in ternary: 1.211p1211 i1.021p1210, and in hexadecimal: 5.C15D84p13 i1.5540BAp13.

For complex numbers, all the above rules are applied separately to the real and imaginary part. In fraction mode, the real and imaginary part, or modulus and angle part are also a separate fraction. Two modes are available for complex numbers: rectangular and polar. In rectangular mode, the real and imaginary part are shown, separated by the symbol "i" in the middle. This is different than mathematical notation, because here i is a separator! What is written as 1+2i in mathematics, is displayed as 1 i2 here. Or what is written as -5i in mathematics, is displayed as 0 i-5 here (so it is NOT i minus real 5, but, i multiplied by -5). In polar mode, the modulus is displayed first, then an "L" symbol which represents the "angle" symbol as it would look on a 7-segment LCD screen, and the angle. The angle's display depends on the currently angle modes, e.g. when using degrees it's in range -180 - 180, if it's radians it's in range -pi - pi, etc... For example:

It is also possible to choose whether to use the dot or comma as decimal separator. Thousand separator can be enabled with HYP+./, and use the other character.


This calculator is keystroke programmable. This means a program can be a sequence of keys automatically executed with just a single key press.

There are 26 independent programs. To select a current program, press SEL, followed by 0-9 or A-F, or +,-,*,/,SIN,COS,TAN,EXP,SQRT,POW (The value 26 is not related to the alphabet). The currently selected program is the one edited by P/R, executed by R/S, and the one used by integrate, solve, etc... The other programs are unused and untouched, until they are selected by SEL. The XEQ button, however, allows to easily execute another program without selecting it. Because they are incompatible, RPN and ALG mode each have their own independend programs. So in reality there are twice as much programs. In ALG mode, you never see the programs of RPN mode, and vice versa.

Entering a program

To enter a program, go to program mode by pressing P/R. Then press all keystrokes in the correct order. Then press P/R again to go back to normal mode. If a program was already entered and you want to clear it, press PCLR before entering the new program.

When entering a program, after each keystroke, it shows the current program step (line number) and a short letter code of the key on screen. The backspace button can be used to undo the last keystroke. The BST and SST keys move forwards and backwards in the program, allowing to view previous instructions and inserting new ones between there. Each key with a label or behind HYP has a short letter code, that is, functions behind f, g or HYP have their own short letter code and the modifier key is not programmed itself. However, other modifiers, such as MATRIX, are programmed as keystrokes and the key keeps its non modified short letter code.

For example, to enter a program that calculates x², press P/R, then x², then P/R again to exit programming mode. To enter a program to calculate sinc(x), which is sin(x) / x, first clear the previous program with PCLR. For an RPN program press P/R, ENTER, SIN, x↔y, /, P/R. For an algebraic program to do the same (however it has to use memory due to no RPN stack), press P/R, STO, 0, SIN, /, RCL, 0, ENTER, P/R. Then, to try out the program, e.g. to calculate sinc(5), press 5, then R/S, and the result is shown (0.0174311485495 if angle mode is in degrees).

Another example: The generalized fibbonaci number in RPN mode, 1/sqrt(5) * (φ^x - φ^(-x)*cos(pi * x). This program requires radians, so the first instruction is to enable radians. In programming mode, clear the program if it's not empty, then enter: RAD STO 0 5 SQRT 1/X φ RCL 0 POW φ RCL 0 +/- POW RCL 0 * π COS * - MUL

More examples, all in RPN, all assume being in program mode with cleared program. These example are here because these formulas are not in the calculator itself due to being easy to program.

Running a program

To run a program, go out of program mode (press P/R if in program editing mode). Then, there are two ways to run the program: The R/S button runs the program from the current instruction pointer (ip) position till the end. The ip will usually be at 0: after running a program, or when editing a program and entering the last instruction last, the ip will be at 0. So in that case R/S simply runs the program from the beginning. However, if a program pauzed itself, or the BST/SST buttons were used during or after editing the program, the ip may be elsewhere.

The other way to run the program is to use the XEQ button. This always runs a program from ip 0, and allows running other programs than the current one. After pressing XEQ, press 0-9 or A-F to select which program to run. E.g. if in "0" you made a program to calculate the error function, and in "A" you made a program to calculate sinc(x), press "XEQ 0" to calculate the error function, "XEQ A" to calculate sinc. Using XEQ does not change the selected program (the one that gets edited with P/R, ran with R/S, or used by integral, solve, etc...). The SEL button does that.

Program Flow

Apart from keystroke sequences, programs can also contain conditions, loops, etc...

The IF instruction requires entering an END instruction later, and optionally an ELSE instruction. It can be used for branches, based on a condition. The IF conditions checks the current value on screen. If it's 0, the part between ELSE and END is executed. Otherwise, the part between IF and ELSE is executed (and it jumps after the END afterwards). Nested IFs are supported. Anything can be used as the IF condition: e.g. the test operators give 0 or non-0 as answer, so does the "prime?" function, and anything else you create can be designed to put 0 or 1 on top of the stack to be used by an IF. The l.and, l.or, l.xor and l.not allow doing logical operations on such booleans, e.g. to combine multiple conditions for an IF.

The test instructions (equals, <, >, etc...) are binary operators that compare two numbers and give a boolean answer (0 or 1). This can then be used by the IF instruction.

The GTO instruction goes to a certain line number. Whenever you enter an instruction in a program, its line number is shown. The line number to go to is the current top stack value (the value on screen). Normally, when a program runs, it goes sequentially from beginning to end (sometimes skipping parts based on IF instructions). With GTO, you can go to any line number. This can cause an infinite loop, to avoid that a condition can be added by putting the GTO in an IF. Because you may not easily know the line numbers while entering a program, designing it on paper first can be a good idea.

GSB is the gosub instruction. It's similar to GTO, except that it remembers where it was. When later an RTN instruction is encountered, it goes back to where GSB was called. This allows creating functions. Up to 100 nested GSB calls are supported.


The definite integral of a function can be calculated. The function must be defined with a program. The integral itself is a binary operator: the two arguments it takes are the start and the end of the definite integral range. To calculate the integral from 100-200 of x², first enter the program x²: press PCLR if needed, then P/R, x², P/R. Then in RPN mode press 100 ENTER 200 ∫f. In algebraic mode, press 100 ∫f 200 ENTER. The result, 2333333.3333333, is shown.

Summation and product

Summation and product work exactly the same as the integration operator. Summation adds values in the range, with step 1 between each value. Product does the same but multiplies them. E.g. to multiply the number 1, 2, 3, 4, 5, you can press PCLR first to clear the program (now the program is empty and thereby represents the function "x". Nothing needs to be entered in the program). Then in algebraid mode press 1 Πf 5 ENTER, and the result, 120, is shown.


This works similar to integration, but it takes only one value instead of two: the value for which to show the derivative. For example, when f = x², to calculate f'(5), type: PCLR, P/R, x², P/R, 5, ∂. The answer, 10 (or approximate 9.99999) is shown. To calculate the second order derivative, use the ∂² button instead.


This finds a zero of the function represented by the program. This operator takes two arguments: the begin and end of the range to search in. If no zero is found inside that range, it returns NaN instead. E.g. to find a root of x - 5 in range -20 to 20, press (in algebraic mode): PCLR, P/R, -, 5, ENTER, P/R, -20, solve, 20, ENTER. The result, 5, is shown.


For matrices, there's only one new button: "matrix". Pressing it, followed by another button, does a matrix operation.

Some matrix operators store the result overwriting the input matrix. That is: negate, conj, transpose, make zero/identity matrix.
Most other unary and binary matrix operators store the result in memory register 600 (F) and on.
Any unary matrix operator with two results stores one result overwriting the input matrix, the other in memory register 600 (F) and on.
Matrix operators that output a matrix display the memory address of the result screen (usually 600).
Matrix operators that output a scalar simply display the scalar on screen.

Supported operations are:

Basic operations:

Advanced operations: Memory/other operations: The elop button allows doing an element-wise operation between a matrix and a scalar. When pressing matrix first, then the elop button, it does an element-wise operation with the corresponding elements of two (or more) matrices. This works with any operator (multiplication, COS, erf, ...). But the ones most useful for matrices are listed here: When pressing hyp first, then the elop button, it does an eigenvalue decomposition to the matrix, then applies any operator to the diagonal matrix, and then recomposes the matrix. This allows doing arbitrary operations to the matrix. Some above matrix operators, like Matrix+COS, already do the same thing internally, but this allows doing even more such matrix operations, like taking the acos, LambertW or erf of a matrix.

To use a matrix operator, instead of putting operands on the stack, you put a memory index pointing to each matrix on the stack.

That register in memory, and the successive ones, represent the matrix. The matrix result of a binary operation will be stored by default at memory register 600 (the one accessible with RCL F), while the result of an unary matrix operation that doesn't alter matrix size, will be stored at the same location as where the input matrix was (overwriting the original).

The user needs to make sure matrices are far apart enough in memory to not overlap (an NxN matrix consumes NxN+2 registers). For example to add two 2x2 matrices A and B, A can be stored at register 0 (to 5), B at register 6 (to 11), and the result will be by default in register 600 (to 605). However the convenient memory locations A-F (100, 200, 300, 400, 500, 600) can be used instead, these are far enough apart for most use cases.

The format of a matrix in memory at register N is: at register N itself is the height of the matrix, at register N+1 the width. At the NxN next registers are all the values of the matrix, row by row. Because using the Σ+ after STO or RCL allows easily storing/reading from successive registers, entering and viewing matrices is easy. Matrices support complex numbers since the most primitive number value is complex and a complex number is stored in one register. E.g. to view the output matrix, first use RCL F, to see the height of the matrix. Then RCL Σ+ to see the width. Then RCL Σ+ to see the first value, and so on to see the next values.

Here's an example of how to add the matrix [[1,2],[3,4]] and [[8,8],[8,8]] using nothing but keyboard shortcuts, in RPN or ALG mode (where s is STO, t is Σ+, r is RCL):
enter first matrix at memory 100-105: 2 s a 2 s t 1 s t 2 s t 3 s t 4 s t
enter second matrix at memory 200-205: 2 s b 2 s t 8 s t 8 s t 8 s t 8 s t
add them (RPN mode): m a enter m b m + --> it should now show "600" on screen (the memory index where the result matrix starts)
add them (ALG mode): m a m + m b enter --> it should now show "600" on screen
view the result at memory 600-605: r f r t r t r t r t r t --> it should have shown 2, 2, 9, 10, 11, 12 on screen

More matrix examples (in RPN):

More matrix examples (in alg mode):

A column vector (e.g. for "solve") has a height of n and a width of 1, so to enter e.g. a 3D column vector [7,8,9] in memory address 100 (a), use: 3, STO, a, 1, STO, Σ+, 7, STO, Σ+, 8, STO, Σ+, 9, STO, Σ+.


This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Copyright (c) 2011-2015 by Lode Vandevenne.