Tools
Python, PHP & Java Code Runner
Edit the example and hit Run to execute it on the server. Output appears below the editor.
Press Run — the program output appears here.
About the code runner
This is a full-page playground for Python, PHP, and Java — languages a browser can’t execute itself. Your code is sent to W3Docs’ runner service, compiled or interpreted inside an isolated, short-lived sandbox, and the program’s output (or its compiler/runtime error) is returned to the panel below the editor. There’s no signup and nothing to install.
It complements the HTML/CSS/JS playground at /tools/editor: that one renders front-end code entirely in your browser, while this one exists precisely for the code that has to run on a server. Book chapters hand long examples across to this page through the URL fragment (#code=…), which stays in your browser’s address bar and is never part of the request itself.
Each run is capped at roughly 20 seconds of wall-clock time, so it’s meant for snippets, exercises, and quick experiments — not servers, sleeps, or programs that wait for input. Standard output and standard error are both captured; if the program prints nothing, the panel says so rather than leaving you guessing.
Frequently asked questions
Is the code I run private?
Code is sent to the runner service only to be executed, runs in an isolated one-off sandbox, and the sandbox is discarded after the run. Still, treat it like any online tool: don’t paste secrets, API keys, or production credentials.
Which languages can I run?
Python, PHP, and Java. For HTML, CSS, and JavaScript use the browser playground at /tools/editor, which runs everything locally in an iframe.
Why did my program stop before finishing?
Runs are limited to about 20 seconds and programs can’t read interactive input. Long loops, sleeps, or anything waiting on stdin will be cut off — trim the example down to the part you’re testing.
Can I share what I wrote?
The editor doesn’t generate share links itself, but chapters across the W3Docs books link into this page with the example pre-loaded via the #code= URL fragment — copying such a URL carries the code with it.