Code execution API for 46 languages, with judging built in
Send code and get back its output, exit code, run time and memory, or send test cases and get a verdict for each. One online compiler API for online judges, coding courses, assessments and AI agents.
Free up to 100,000 runs a month, commercial use included. No credit card. Moving from Judge0 or Piston? Change the base URL.
1,900+ developers have signed up. In September 2026, 162 accounts ran 45,426 programs through it. Who we are.
each test in its own gVisor sandbox
POST /api/run-tests/
python-3.14
| test | verdict | time | memory |
|---|---|---|---|
| 1 | accepted | 0.0213 s | 9,216 KB |
| 2 | accepted | 0.3412 s | 41,872 KB |
| 3 hidden | accepted | ||
| 4 hidden | time_limit_exceeded |
Live demo: Python with pandas and Matplotlib, in the widget you can embed.
Ctrl + Enter
# pandas + matplotlib: plt.show() returns the chart
import pandas as pd
import matplotlib.pyplot as plt
sales = pd.DataFrame({
"month": ["Jan", "Feb", "Mar", "Apr", "May", "Jun"],
"units": [120, 135, 160, 148, 190, 210],
})
print("Total units:", sales["units"].sum())
print("Best month:", sales.loc[sales["units"].idxmax(), "month"])
plt.figure(figsize=(4.5, 3))
plt.bar(sales["month"], sales["units"])
plt.title("Units sold per month")
plt.show() Send CSV files in and get charts back from the API too. Code interpreter API
Online judge API: a verdict for every test
Send the program and its tests to /api/run-tests/. Each
test runs in its own fresh sandbox, and the response holds a verdict for each test, an overall verdict and a
score.
curl -X POST https://api.onlinecompiler.io/api/run-tests/ \
-H "Authorization: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"compiler": "python-3.14",
"code": "a, b = map(int, input().split())\nprint(a + b)",
"tests": [
{"input": "1 2", "expected_output": "3"},
{"input": "-4 10", "expected_output": "6"},
{"input": "99 1", "expected_output": "100", "hidden": true}
],
"checker": "tokens",
"scoring": "percent"
}'- Hidden tests
- Come back with only their verdict: no output, time or error a student could read the input from.
- Five checkers
- trim, exact, tokens, float with a tolerance you set, or rows for SQL and pandas results in any row order.
- Three ways to score
- all_or_nothing, percent, or weighted by test.
- Compiled once
- When a request has more tests than run at once, C, C++ and Java compile one build that every test runs.
- Up to 80 tests a request
- 8 on Free, within a 60-second budget. Each test counts as one run.
- For AI agents too
- The MCP server's run_tests tool returns the same verdicts.
On Judge0 or Piston? Change the base URL
Both APIs are served in their own shapes, on your one key: requests, responses, status ids, batches and
callbacks. On the Judge0 API, wait=true works too.
- 66 of Judge0 CE's 71 language ids run, older ones on the current version.
- Piston's language names and aliases work for all 46 languages.
- The same sandbox, limits and monthly allowance as the native API.
Judge0 migration guide Moving off Piston Coming from Sphere Engine
# Judge0Remove: https://judge0-ce.p.rapidapi.com/submissionsAdd: https://api.onlinecompiler.io/api/judge0/submissionsRemove: X-RapidAPI-Key: YOUR_RAPIDAPI_KEYAdd: X-Auth-Token: YOUR_API_KEY # PistonRemove: https://emkc.org/api/v2/piston/executeAdd: https://api.onlinecompiler.io/api/v2/piston/executeAdd: Authorization: YOUR_API_KEYCall it from a server, a web page or an AI agent
The same languages, limits and sandbox, whichever you choose.
Backends, graders and batch jobs
The sync endpoint returns the result in the response. For long jobs, queue the run and have the result posted to your callback URL.
REST API referencecurl -X POST https://api.onlinecompiler.io/api/run-code-sync/ \
-H "Authorization: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"compiler": "python-3.14", "code": "print(\"Hello, World!\")"}'{
"output": "Hello, World!\n",
"error": "",
"status": "success",
"exit_code": 0,
"signal": null,
"truncated": false,
"time": "0.0248",
"memory": "8192",
"total": "0.0330"
}Tutorials, docs and courses
A runnable editor on your page, with a JavaScript API and hidden code around the reader's. Sites that strip scripts can paste an iframe instead.
Embed the widget<script src="https://onlinecompiler.io/widget.js"></script>
<div class="runcode" data-key="YOUR_WIDGET_KEY" data-lang="rust-1.93"></div>
<!-- Or, where only iframes are allowed -->
<iframe src="https://api.onlinecompiler.io/embed/?key=YOUR_WIDGET_KEY&lang=rust-1.93"
title="Runnable Rust example" width="100%" height="420" style="border: 0"></iframe>Interactive apps and IDEs
Results are pushed to the browser over Socket.IO the moment a run finishes, with no polling.
WebSocket guideconst socket = io("wss://api.onlinecompiler.io", {
auth: { token: "YOUR_KEY" },
});
socket.emit("runcode", { compiler: "go-1.26", code });
socket.on("codeoutput", (result) => render(result.output));Claude, Cursor and VS Code
Your agent gets list_compilers, run_code and run_tests, and runs code in the sandbox instead of on your machine.
MCP code execution serverclaude mcp add onlinecompiler \
https://api.onlinecompiler.io/mcp \
--transport http \
--header "Authorization: Bearer YOUR_KEY"46 languages on current versions
Next to each, the median seconds from request to response for a small program, compile included: 20 runs per language on production on 18 October 2026, sent from the API server, so your own network round trip comes on top.
- Python 3.14 0.56 s
- C GCC 15 0.67 s
- C++ G++ 15 1.31 s
- Java OpenJDK 25 2.25 s
- C# .NET SDK 10 3.08 s
- F# .NET SDK 10 4.61 s
- Go 1.26 1.26 s
- Rust 1.93 0.92 s
- PHP 8.5 0.58 s
- Ruby 4.0 0.69 s
- Haskell GHC 9.12 1.63 s
- TypeScript Deno 0.58 s
- JavaScript Node.js 24 0.60 s
- SQL SQLite 3 0.53 s
- DuckDB 1.5 s
- Bash 5.2 0.52 s
- Fortran gfortran 15 0.69 s
- Visual Basic .NET SDK 10 3.24 s
- Kotlin 2.4 4.59 s
- R 4.6 1.04 s
- Swift 6.4 1.56 s
- COBOL GnuCOBOL 3.2 1.05 s
- Perl 5.44 0.73 s
- Julia 1.13 1.11 s
- Pascal Free Pascal 3.2 0.98 s
- Octave 11 1.27 s
- Assembly NASM 3 0.68 s
- Lua 5.5 0.56 s
- OCaml 5.4 1.40 s
- Common Lisp SBCL 2.6 0.61 s
- Erlang OTP 29 1.41 s
- Elixir 1.20 1.69 s
- Prolog SWI-Prolog 10 0.62 s
- D LDC 1.43 2.13 s
- FreeBASIC 1.10 1.04 s
- Dart 3.13 1.42 s
- Clojure 1.12 1.64 s
- Groovy 6.0 3.03 s
- Scala 3.10 3.68 s
- Zig 0.17 3.99 s
- Nim 2.2 2.05 s
- Crystal 1.22 8.49 s
- Ada GNAT 15 1.22 s
- PowerShell 7.6 1.88 s
- Racket 9.3 0.99 s
- Objective-C Clang 21 1.81 s
Safe for code your users submit
Every run starts in a fresh container under gVisor, which handles the program's system calls itself, so the code never talks to the host kernel directly. It runs as a non-root user on a read-only image, with no capabilities and no network, and the container is removed as soon as the run ends.
How the sandbox works All limits, including code and output size
host kernel
gVisor (runsc), handles every system call
container, fresh per run
- CPU
- 2 cores
- Memory
- 512 MB
- Processes
- 16
- Timeout
- 30 s
- Network
- off
- Capabilities
- none
your code
Compared with Judge0 and Sphere Engine
Where each one is stronger, from the vendors' own pages on 18 October 2026.
| OnlineCompiler.io | Judge0 (hosted) | Sphere Engine | |
|---|---|---|---|
| Free plan | 100,000 runs a month, commercial use included | None at checkout | 14-day trial |
| Paid from | $10 a month for 150,000 runs | $44.99 a month on RapidAPI for 2,000 runs a day | Quote only |
| Judging | A verdict per test, hidden tests and scoring, in one request | One expected output per submission, batches of 20 | Stored problems and custom judges, in the separate Problems module |
| Getting the output | One call returns it | Submit, then poll the token | Create, poll every 2 s, then fetch each stream |
| Newest versions | Java 25, Go 1.26, Ruby 4.0 | Java 17, Go 1.23, Ruby 2.7 | Java 22, Go 1.22, Ruby 3.1 |
| Time per run | 30 s, compile included | 5 s of CPU by default, up to 20 s | 1–15 s, compile excluded |
| Memory | 512 MB | 256 MB by default, up to 2 GB | 1.5 GB |
| Sandbox | gVisor, fresh per run, no network | isolate | Not disclosed |
| AI agents | Official hosted MCP server | Community MCP wrappers | None |
| Self-hosting | No, hosted only | Yes, GPL-3.0 | On request |
Judge0 alternatives, with JDoodle, OneCompiler and Codapi Sphere Engine alternative
A free code execution API, up to 100,000 runs a month
Commercial use included, and no credit card. Paid plans stop at their limit, with no overage charges.
- Free
- $0 a month
- 100,000 runs a month
- 2 runs at once
- Commercial use included
- Starter
- $10 a month
- 150,000 runs a month
- 4 runs at once
- $0.067 per 1,000 runs
- Pro
- $49 a month
- 1,000,000 runs a month
- 4 runs at once
- $0.049 per 1,000 runs
- Business
- $199 a month
- 4,000,000 runs a month
- 16 runs at once
- Coming soon
Need more, an SLA or limits set for your volume? Ask about Enterprise.
Questions developers ask
- Is there an API that compiles code and returns the output and errors?
- Yes. POST the source code, a compiler id and optional input to https://api.onlinecompiler.io/api/run-code-sync/ and the response holds stdout, stderr or compiler errors, the exit code, run time and memory. It covers 46 languages, from Python, Java and C++ to Rust, Go and SQL.
- Is there a free code execution API?
- Yes. The Free plan includes 100,000 runs a month in every language, commercial use included, with no credit card. Paid plans start at $10 a month for 150,000 runs, and Pro works out to $0.049 per 1,000 runs.
- Can I judge submissions against test cases, like LeetCode?
- Yes. POST /api/run-tests/ runs one program against up to 80 tests (8 on Free) and returns a verdict for each, such as accepted, wrong_answer or time_limit_exceeded, plus an overall verdict and a score. Hidden tests return only their verdict, and C, C++ and Java compile once per request.
- Is there a hosted Judge0 alternative that needs no self-hosting?
- Yes. OnlineCompiler.io serves Judge0's API at https://api.onlinecompiler.io/api/judge0, so a Judge0 client moves by changing its base URL and key, with nothing to install and no cgroup v1 or privileged containers. 66 of Judge0 CE's 71 language ids run, and wait=true works.
- The public Piston API is closed. What can I use instead?
- Since 15 February 2026 emkc.org only serves whitelisted non-commercial educational projects. OnlineCompiler.io serves Piston's /runtimes and /execute at https://api.onlinecompiler.io/api/v2/piston, so a Piston client needs a new base URL and a free API key.
- How do you run user-submitted code safely?
- Each run gets a fresh container under gVisor, which handles the program's system calls in user space, so the code never talks to the host kernel directly. It runs as a non-root user on a read-only image with no capabilities and no network, capped at 512 MB of memory, 2 CPUs, 16 processes and 30 seconds, and the container is deleted when the run ends.
- Can AI agents run code with it?
- Yes, through the MCP server at https://api.onlinecompiler.io/mcp. It gives Claude, Cursor, VS Code and other MCP clients three tools: list_compilers, run_code and run_tests. The agent's code runs in the sandbox instead of on your machine, and each agent can have its own key with a monthly limit.
- Are libraries like NumPy and pandas installed?
- In Python, yes: NumPy, pandas, SciPy, scikit-learn, Matplotlib, seaborn, statsmodels, SymPy, openpyxl, Pillow and DuckDB, at published versions, and charts come back with the result. Other languages have their standard library, and programs have no network access to install more packages. If your problems need other packages, tell us which ones.