Try online
Magma Calculator
Write Magma code below and press Run or Ctrl+Enter
How to use the calculator
Each run is its own Magma session
Nothing you define in one run is still there in the next — assign a variable, run again, and it is gone. With Keep Input ticked, your code stays in the editor, so what you see is exactly what runs. Untick it and the editor clears after each run, leaving every run behind as its own card.
Running your code
Press Run, or Ctrl+Enter (Cmd+Enter on a Mac). Every statement ends with a semicolon; the calculator adds one if you forget. Ctrl+] and Ctrl+[ indent, and Tab leaves the editor.
Earlier commands
The ↑ and ↓ buttons beside the editor step back through what you have already run, and so do Ctrl+P and Ctrl+N. The arrow keys do the same from the top and bottom lines of the editor, so they still move the cursor everywhere else. The way to carry work forward is to recall a command and run it together with the new one.
Copying your work
Every run has its own buttons: Copy takes that run with its output, Copy Input takes only the statements. The pair in the title bar does the same for the whole session.
Code you run here is logged with your IP address and kept for 90 days to detect abuse.
Examples
Click any example to load it into the calculator.