Piston vs Judge0: which code execution engine fits your project
Both are open-source engines that run untrusted code with Isolate inside Docker. Judge0 judges a submission against an expected output and sells hosted plans; Piston runs code and returns its output, and its public API closed in February 2026. Here is how they differ, from each project's own documentation.
The short answer
- Pick Judge0 if you need verdicts (Accepted, Wrong Answer, Time Limit Exceeded), batches, callbacks and limits you can set per submission, and you can run a Linux host booted with cgroup v1.
- Pick Piston if you only need a program's output, want the most languages and the MIT licence, and run a current Linux host with cgroup v2.
- Pick a hosted API if you don't want to run a sandbox at all. OnlineCompiler.io answers both engines' APIs, so either client moves by changing its base URL (below).
Piston and Judge0 side by side
| Piston | Judge0 | |
|---|---|---|
| What it does | Runs code, returns output | Runs code, returns output and a verdict against an expected output |
| Licence | MIT | GPL-3.0 |
| Latest release | No versioned releases; last commit 31 July 2026 | v1.13.1, 18 April 2024 |
| Sandbox | Isolate inside a privileged Docker container | Isolate inside privileged Docker containers (server and workers) |
| Host kernel | cgroup v2 on, cgroup v1 off | cgroup v1 (systemd.unified_cgroup_hierarchy=0) |
| Parts to run | One API container, plus a CLI to install language packages | API server, workers, PostgreSQL and Redis |
| Languages | 84 on the public instance; you install the ones you want | 71 language versions on CE, more on Extra CE |
| Judging | None: compare the output yourself | One expected_output per submission, with 14 statuses |
| Getting the result | In the same response | A token, then polling or a callback; wait=true returns it in the same request on a self-hosted install, but is off on Judge0's public instance |
| Batches | No | Up to 20 submissions a request |
| Default limits | 3 s to run, 10 s to compile, no memory cap, 1,024 characters of output (configurable) | 5 s of CPU and 256 MB, raisable per submission to 20 s and 2 GB on the public instance (config) |
| Network in the sandbox | Off by default | Off by default |
| Telemetry | None documented | On by default; can be turned off |
| Hosted by its makers | Public API whitelist-only since 15 February 2026 | From €27 a month for 2,000 submissions a day (every plan) |
Judging: the biggest difference
Judge0 was built for online judges. You send the expected output with the code, and the submission comes back with a status: Accepted, Wrong Answer, Time Limit Exceeded, Compilation Error and so on. Piston was built to run code for chat bots and playgrounds: it returns stdout, stderr and the exit code, and deciding whether the answer is right is your code's job.
# Judge0: submit with the expected output, get a token, then fetch the verdict
curl -X POST "http://localhost:2358/submissions?base64_encoded=false" \
-H "Content-Type: application/json" \
-d '{"language_id": 71, "source_code": "print(int(input()) * 2)", "stdin": "21", "expected_output": "42"}'
# {"token": "..."}
curl "http://localhost:2358/submissions/TOKEN?base64_encoded=false"
# ... "stdout": "42\n", "status": {"id": 3, "description": "Accepted"}# Piston: run the code and read its output; comparing it is up to you
curl -X POST "http://localhost:2000/api/v2/execute" \
-H "Content-Type: application/json" \
-d '{"language": "python", "version": "*", "files": [{"content": "print(int(input()) * 2)"}], "stdin": "21"}'
# {"run": {"stdout": "42\n", "stderr": "", "code": 0, "signal": null, ...}, ...}Neither keeps your tests for you or judges several at once: Judge0 compares one expected output per submission, so a problem with ten tests is ten submissions (or one batch). If you are building a LeetCode-style site, a grader or a contest, see how to build an online judge on an online judge API.
Running them yourself
Both run in privileged Docker containers, so a sandbox escape reaches the host: give them a server of their own. The big practical difference is the kernel they need.
- Judge0 1.13.1's documented install expects cgroup v1, which Ubuntu 22.04 and later only give you after a GRUB change and a reboot. Newer systemd releases are dropping cgroup v1: 256 and 257 boot with it only when forced, and 258 removed it. On WSL2, Docker Desktop and many container hosts it fails with cgroup errors. See how to self-host Judge0 and the cgroup v2 error.
- Piston asks for the opposite: cgroup v2 on and v1 off, which is the default on current
distributions. You start one container, then install each language you want with its CLI
(
cli/index.js ppman install python). - Upkeep is yours with either: security fixes, language updates, scaling workers, and watching the queue. Judge0's last release fixed three critical sandbox escapes; Piston publishes no versioned releases, so you follow its main branch.
Hosted options
If you only chose between them to have something run your users' code, you can skip the sandbox host. OnlineCompiler.io answers both APIs on one key:
| Your client speaks | Point it at | Send the key in | Details |
|---|---|---|---|
| Judge0 CE | https://api.onlinecompiler.io/api/judge0 | X-Auth-Token | Migrating from Judge0 |
| Piston v2 | https://api.onlinecompiler.io/api/v2/piston | Authorization | Moving off Piston |
Its own run-tests endpoint judges many tests in one request, with hidden tests, a verdict for each and a score, and stored problems keep the tests on the API. Every run gets a fresh gVisor sandbox with no network, up to 30 seconds and 512 MB. The free plan includes 100,000 runs a month with commercial use. It runs 46 languages, fewer than either engine, and it is hosted only: there is no version to run on your own servers. Judge0 alternatives compares the other hosted services.
Frequently asked questions
Is Piston better than Judge0?
For different jobs. Judge0 judges: send the expected output and it returns a verdict such as Accepted or Wrong Answer, with batches, callbacks and per-submission limits. Piston only runs code and returns its output, with more languages, a simpler install and the MIT licence. If you are building an online judge or a grader, Judge0 does more of the work; if you only need output, Piston is lighter.
Does Piston support test cases?
No. Piston runs a program with the stdin and arguments you send and returns stdout, stderr and the exit code. To judge, you run it once per test and compare the output yourself. Judge0 compares one expected output per submission for you.
Can Piston and Judge0 run on the same server?
Not easily. Judge0 1.13.1 needs the host booted with cgroup v1, and Piston needs cgroup v2 with v1 turned off, so each wants the opposite kernel setting. Give each its own server or VM.
Which is free?
Both are open source and free to self-host: Piston under MIT, Judge0 under GPL-3.0. Neither has a free hosted service now: the public Piston API is whitelist-only since 15 February 2026, and Judge0 sells hosted plans by the day.
Is the public Piston API still available?
Only to whitelisted projects. Since 15 February 2026, emkc.org grants keys to good-cause, non-commercial educational projects, and not to paid products or coursework; everyone else gets HTTP 401.
Is there a hosted service that speaks both APIs?
Yes. OnlineCompiler.io answers Judge0 CE's API at https://api.onlinecompiler.io/api/judge0 and Piston's v2 API at https://api.onlinecompiler.io/api/v2/piston, on the same key, with 100,000 free runs a month. It runs 46 languages, fewer than either engine, and is hosted only.