onlinecompiler.io

The public Piston API is closed. Here's a hosted replacement.

Since 15 February 2026, emkc.org only runs code for whitelisted, non-commercial educational projects. If your app called it, it now gets a 401. Here are your options, and how to move your Piston calls to OnlineCompiler.io by changing the base URL.

What changed

The Piston README now says the public API is no longer freely available, and that authorization is only granted to good-cause, non-commercial educational projects. Requests to https://emkc.org/api/v2/piston/execute without a whitelisted key get HTTP 401 and the message "Public Piston API is now whitelist only as of 2/15/2026".

Before this, the public API allowed 5 requests a second with no key, which is why so many hobby projects, Discord bots, classroom tools and coding-practice sites were built on it. For a bot, there is a tested !run command for Discord and Telegram on this API.

Looking for the exact error text and a quick fix? See Piston API 401: "Public Piston API is now whitelist only".

Your three options

OptionGood fit whenWhat it costs you
Apply for whitelistingYour project is non-commercial and educational.Asking on the EngineerMan Discord and waiting. Paid, individual, portfolio, coursework and AI-generated projects don't qualify.
Self-host PistonYou need one of its 84 languages, want full control, or already run servers.Free software (MIT), but you run the Docker host, install packages, and handle updates, security and scaling. Weighing it against Judge0? See Piston vs Judge0.
Switch to a hosted APIYou want to keep shipping without running sandboxes.A new base URL and API key. OnlineCompiler.io is free up to 100,000 runs a month; see how the hosted options compare.

Switch by changing the base URL

OnlineCompiler.io answers Piston's v2 API at https://api.onlinecompiler.io/api/v2/piston. Point your Piston client or HTTP calls there and send your API key in the Authorization header. The /runtimes and /execute endpoints keep Piston's request and response shapes, and errors come back as {"message": "..."}, so code that handled Piston's answers keeps working. Keep the API key on your server; never ship it to the browser. If your page called emkc.org directly, the Piston API docs have a short server route (Next.js, Netlify or a Cloudflare Worker) for the page to call instead.

Terminal
curl -X POST https://api.onlinecompiler.io/api/v2/piston/execute \
  -H "Authorization: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "language": "python",
    "version": "3.10.0",
    "files": [{ "name": "main.py", "content": "print(input()[::-1])" }],
    "stdin": "piston"
  }'
Piston (emkc.org)OnlineCompiler.io
https://emkc.org/api/v2/pistonhttps://api.onlinecompiler.io/api/v2/piston
Whitelisted keyAuthorization: YOUR_API_KEY, free to create
GET /runtimesSame shape: our 46 languages under Piston's names and aliases (py, c++, csharp...)
versionAccepted and ignored: the current version in the table below runs
filesThe first entry is the program; further entries are helper source files, compiled or loaded with the program, or input files the program reads from its working directory; folders are allowed (up to 20 files and 1 MB in total)
argsPassed to the program, up to 32 strings; not for sqlite-3, duckdb-1.5 or erlang-29
run_timeoutHonoured, up to 30 s
run_memory_limitIgnored: every run gets 512 MB
compile stageNone: compiler errors arrive in run.stderr with a non-zero run.code
run.statusRE, TO, SG, OL and XX, as in Piston
run.cpu_timenull; wall_time (ms) and memory (bytes) are filled in

The full list of differences is in the API docs. Runs count toward your monthly allowance like any other request.

Or move to the native API

The native endpoints add async callbacks, WebSocket, the embeddable editor and MCP, judging against test cases with a verdict for each, and a project's own pytest, Jest, JUnit, xUnit or NUnit test suite run as one run, with a PostgreSQL database on Pro. The sync endpoint takes the program and optional stdin, and returns the result in the same request, like Piston does. From Node.js or Python, the official clients make the call for you: npm install onlinecompiler or pip install onlinecompiler, then client.run(...) (see the Node.js and Python clients). Piston's own wrappers are community packages. Ours are MIT licensed on GitHub, next to starter apps built on them, such as a LeetCode-style practice site.

Piston requestOnlineCompiler.io
language + versioncompiler, one id per language, such as python-3.14
files[0].contentcode
stdininput
files[1..]files: up to 20 further files, each {name, content}, with folders allowed; helper source files are compiled or loaded with the program (several source files)
argsargs, the same list of strings (arguments)
run_timeout, run_cpu_timeHonoured: the run stops at the lower of the two, capped at 30 s, and compiling does not count; Java, Groovy and F# get a start-up allowance on top (Java 1 s, Groovy 1.5 s and F# 2.5 s)
run_memory_limit (bytes)memory_limit, in whole MB from 16 to 2048: higher than 512 raises the cap on Pro and above, lower is checked against the program's peak (memory limit)
Compile limitsIgnored: compiling does not count toward time_limit, and compile and run together stop at 30 s
Authorization (whitelisted key)Authorization: YOUR_API_KEY

Mapping the response

Piston responseOnlineCompiler.io
run.stdoutoutput
run.stderrerror
run.output (both streams)Not returned; join output and error
run.codeexit_code
run.signalsignal, as a number (9 for SIGKILL), or null
compile stageNo separate object; compile errors arrive in error with status: "error"
run.status TO (timeout)exit_code 124
run.status OL / EL (output too long)truncated: true, with the first 64 KB kept
run.cpu_time, wall_time (ms)time (run) and total (with compile), in seconds, as strings
run.memory (bytes)memory, in KB, as a string

Language mapping

The versions on the public Piston instance are several years old. Each language on OnlineCompiler.io runs a current release:

Piston languagePiston version (emkc.org)compilerVersion
python3.10.0python-3.14Python 3.14
cGCC 10.2.0gcc-15C GCC 15
c++GCC 10.2.0g++-15C++ G++ 15
java15.0.2openjdk-25Java OpenJDK 25
csharp / csharp.netMono 6.12 / .NET 5.0dotnet-csharp-10C# .NET SDK 10
fsharp.net.NET 5.0dotnet-fsharp-10F# .NET SDK 10
go1.16.2go-1.26Go 1.26
rust1.68.2rust-1.93Rust 1.93
php8.2.3php-8.5PHP 8.5
ruby3.0.1ruby-4.0Ruby 4.0
haskell9.0.1haskell-9.12Haskell GHC 9.12
typescript5.0.3 (Node) / Deno 1.32.3typescript-denoTypeScript Deno
javascriptNode 18.15.0 / Deno 1.32.3nodejs-24JavaScript Node.js 24
sqlite33.36.0sqlite-3SQL SQLite 3
bash5.2.0bash-5.2Bash 5.2
fortranGCC 10.2.0gfortran-15Fortran gfortran 15
basic / basic.netMono 6.12 / .NET 5.0dotnet-vbnet-10Visual Basic .NET SDK 10
kotlin1.8.20kotlin-2.4Kotlin 2.4
rscript4.1.1r-4.6R 4.6
swift5.3.3swift-6.4Swift 6.4
cobol3.1.2gnucobol-3.2COBOL GnuCOBOL 3.2
perl5.36.0perl-5.44Perl 5.44
julia1.8.5julia-1.13Julia 1.13
pascal3.2.2fpc-3.2Pascal Free Pascal 3.2
octave8.1.0octave-11Octave 11
nasm642.15.5nasm-3Assembly NASM 3
lua5.4.4lua-5.5Lua 5.5
ocaml4.12.0ocaml-5.4OCaml 5.4
lispSBCL 2.1.2sbcl-2.6Common Lisp SBCL 2.6
erlang23.0.0erlang-29Erlang OTP 29
elixir1.11.3elixir-1.20Elixir 1.20
prologSWI-Prolog 8.2.4swipl-10Prolog SWI-Prolog 10
dGDC 10.2.0ldc-1.43D LDC 1.43
freebasic1.9.0fbc-1.10FreeBASIC 1.10
dart2.19.6dart-3.13Dart 3.13
clojure1.10.3clojure-1.12Clojure 1.12
groovy3.0.7groovy-6.0Groovy 6.0
scala3.2.2scala-3.10Scala 3.10
zig0.10.1zig-0.17Zig 0.17
nim1.6.2nim-2.2Nim 2.2
crystal0.36.1crystal-1.22Crystal 1.22
powershell7.1.4powershell-7.6PowerShell 7.6
racket8.3.0racket-9.3Racket 9.3

javascript and its aliases run on Node.js 24, as on Piston, so require() works. Piston's Deno name for JavaScript, deno-js, runs under typescript-deno, since Deno runs TypeScript files without type-checking; read stdin there with fs.readFileSync(0) or Deno.stdin, as Deno refuses /dev/stdin.

Only Piston's 64-bit assembler, nasm64 (alias asm64), is mapped. Piston's nasm builds 32-bit programs that call the kernel with int 0x80, which our sandbox doesn't run, so those names return an unknown-runtime error.

Piston lists basic as an alias of FreeBASIC too, but resolves it to its Visual Basic language, so basic runs Visual Basic here as well; send freebasic, bas or fbc for FreeBASIC. d (Piston's GDC) compiles with LDC.

Piston has no Ada or Objective-C. They're listed here as ada (aliases gnat, adb) and objective-c (aliases objc, obj-c), so a Piston client can run them too.

What's different from Piston

  • Fewer languages: 46, against Piston's 84.
  • Extra files. Extra files entries may be helper source files, compiled or loaded with the program, folders allowed (several source files), or input data. Command-line args work as on Piston, except in sqlite-3, duckdb-1.5 or erlang-29.
  • Python with data science packages, and files back: Piston's Python 3.12 package bakes in numpy, scipy, pandas and sympy (its build script), and its responses carry text only. Ours has numpy, pandas, scipy, scikit-learn, matplotlib, seaborn, statsmodels, sympy, openpyxl, pillow, duckdb, wordcloud, polars, pgmpy, nltk at published versions, and the run endpoints return charts and other output files (see the code interpreter API). The Piston-compatible endpoints accept files but do not return output files.
  • One version per language: the requested version is ignored, and there's no separate compile stage in the response.
  • Fixed memory, your time limit: 512 MB and 2 CPUs per run. run_timeout lowers the time limit as on Piston, up to 30 seconds against Piston's 3-second default, but you can't raise it past that. run_memory_limit is ignored; the native API's memory_limit sets a lower one, or on Pro and above a higher one, up to 2 GB.
  • More output: up to 64 KB per stream, against Piston's default of 1,024 characters, with truncated: true when it had to cut.
  • Isolation: every run gets a fresh gVisor sandbox (a user-space kernel) with no network access.
  • More ways in: besides the sync endpoint there's an async endpoint with callbacks, WebSocket, an embeddable editor and an MCP server.
  • Judging with async webhooks and signed receipts (checked 4 November 2026): Piston has no callbacks and keeps no results. Run-tests can run asynchronously and post the outcome to your URL in signed, retried webhooks, and it returns a signed receipt for each submission that anyone can verify with our public key (see receipts and verifiable results).

Frequently asked questions

Is the public Piston API still free?

No. Since 15 February 2026 the public API at emkc.org only accepts requests from whitelisted projects, and whitelisting is granted only to non-commercial educational projects. Everyone else has to self-host Piston or use another service.

Why does emkc.org return 401 Unauthorized?

Requests without a whitelisted key get HTTP 401 with a message saying the public Piston API is now whitelist only as of 2/15/2026. Nothing is wrong with your request; the service closed to the public.

Can I still get a Piston API key?

Only for a non-commercial educational project, which is all emkc.org now whitelists. Otherwise, self-host Piston or call a hosted Piston-compatible API: OnlineCompiler.io serves Piston's /runtimes and /execute at https://api.onlinecompiler.io/api/v2/piston, with a free key for 100k runs a month.

Can I self-host Piston instead?

Yes. Piston is MIT-licensed and runs in Docker. You run the servers, install the language packages you need, and handle updates, security and scaling yourself.

Do I have to rewrite my Piston calls?

No. Change the base URL from https://emkc.org/api/v2/piston to https://api.onlinecompiler.io/api/v2/piston and send your OnlineCompiler.io API key in the Authorization header. The runtimes and execute endpoints keep Piston's request and response shapes. Extra files are input data the program reads rather than more source, args reach the program (except in sqlite-3, duckdb-1.5 or erlang-29), and run_timeout is honoured within our limits. Memory limits are ignored: every run gets 512 MB.

Is OnlineCompiler.io free for commercial projects?

Yes. The free plan includes 100,000 runs a month and allows commercial use, with no credit card.

Can Piston run unit tests such as pytest or JUnit?

Piston runs a program and returns its output; it has no test-framework mode. OnlineCompiler.io runs a project's own pytest, Jest, Mocha, node:test, JUnit, xUnit or NUnit suite through POST /api/run-tests/ and returns every test by name with its status and message, as one run. On Pro and above, the suite can also start a fresh PostgreSQL database in the sandbox, seeded from your .sql files, for tests that need one.

Does OnlineCompiler.io support every Piston language?

No. It supports 46 languages, against Piston's 84. If you need a language outside that list, keep a self-hosted Piston for it and send the rest to OnlineCompiler.io.