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

Verdict for each test, then the overall verdict and score
testverdicttime
1 accepted0.0213 s
2 accepted0.3412 s
3 hidden accepted
4 hidden time_limit_exceeded
verdict time_limit_exceeded passed 3/4 score 75.00

Live demo: Python with pandas and Matplotlib, in the widget you can embed.

# 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.

Run tests reference How to build an online judge

Request
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

What changes in your client
# 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_KEY

Call 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 reference
curl -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!\")"}'
200 OK Response
{
  "output": "Hello, World!\n",
  "error": "",
  "status": "success",
  "exit_code": 0,
  "signal": null,
  "truncated": false,
  "time": "0.0248",
  "memory": "8192",
  "total": "0.0330"
}

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

Your code runs inside a container, inside gVisor, on the host.

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.ioJudge0 (hosted)Sphere Engine
Free plan100,000 runs a month, commercial use includedNone at checkout14-day trial
Paid from$10 a month for 150,000 runs$44.99 a month on RapidAPI for 2,000 runs a dayQuote only
JudgingA verdict per test, hidden tests and scoring, in one requestOne expected output per submission, batches of 20Stored problems and custom judges, in the separate Problems module
Getting the outputOne call returns itSubmit, then poll the tokenCreate, poll every 2 s, then fetch each stream
Newest versionsJava 25, Go 1.26, Ruby 4.0Java 17, Go 1.23, Ruby 2.7Java 22, Go 1.22, Ruby 3.1
Time per run30 s, compile included5 s of CPU by default, up to 20 s1–15 s, compile excluded
Memory512 MB256 MB by default, up to 2 GB1.5 GB
SandboxgVisor, fresh per run, no networkisolateNot disclosed
AI agentsOfficial hosted MCP serverCommunity MCP wrappersNone
Self-hostingNo, hosted onlyYes, GPL-3.0On 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.