Python Online Compiler
Real CPython in your browser — with stdin, files and a stop button.
Ctrl+Enter (⌘+Enter) runs. Tab indents; press Esc, then Tab, to leave the editor. Your code is kept in this browser.
Output
Python (about 13.5 MB) is downloaded the first time you press Run.
About the Python Online Compiler
Write Python and press Run. This is real CPython 3.14 — the standard Python interpreter, compiled to WebAssembly by the Pyodide project — running on your own device, so print, input(), exceptions, the standard library and even top-level await behave as they do on a computer with Python installed. Output streams in as the program prints; an error shows Python’s traceback, and selecting a line in it jumps to that line in the editor.
Type what input() should read into the Input (stdin) box, and add data files (a CSV, a JSON, a text file) for your program to open(). Programs run in a Web Worker on an isolated MySmartCoPilot sandbox origin, never on this page: an endless loop cannot freeze the tab, Stop ends it at once, and every run has a time limit.
How to use it
- Write or paste your program, or pick an example. The editor indents Python blocks for you (4 spaces), closes brackets and highlights syntax.
- If the program calls
input(), type the answers into Input (stdin), one line per call. To work with files, choose Add files; they appear in the program’s current folder under their own names (accents are dropped and characters other than letters, digits, spaces,.,_and-become_; the page tells you the new name). - Press Run or Ctrl+Enter (⌘+Enter). The first run downloads Python (about 13.5 MB) with a progress bar; later runs start at once.
- Read the output. For an error, select a line of the traceback (for example
main.py, line 6) to jump there. Stop ends a run; the time limit (30 seconds by default) stops it automatically.
Examples
name = input("What is your name? ")
age = int(input("How old are you? "))
print(f"Hi {name}! In 10 years you will be {age + 10}.")
Input (stdin):
Asha
29What is your name? How old are you? Hi Asha! In 10 years you will be 39.
The prompts are printed but your answers are not echoed, exactly as when a terminal pipes input into python3 main.py.
def average(values):
return sum(values) / len(values)
print(average([4, 8, 15]))
print(average([]))9.0
Traceback (most recent call last):
File "main.py", line 5, in <module>
print(average([]))
~~~~~~~^^^^
File "main.py", line 2, in average
return sum(values) / len(values)
~~~~~~~~~~~~^~~~~~~~~~~~~
ZeroDivisionError: division by zeroPython 3.11 and later mark the failing part of the line with ~ and ^. Select a File "main.py", line … entry to jump to that line.
Common uses
- Practising Python for a course or an interview without installing anything — on a school computer, a Chromebook or a phone.
- Checking a quick calculation, a regular expression or a date computation with the standard library.
- Processing a CSV or JSON file with
csv,json,statisticsorcollectionswhile the data stays on your device. - Showing someone how a snippet behaves, step by step, with
printoutput and real tracebacks.
What is available
- The whole Python standard library that works in a browser:
math,statistics,random,datetime,json,csv,re,collections,itertools,functools,dataclasses,decimal,fractions,sqlite3,hashlib,textwrap,unittest,asyncioand more. input()andsys.stdinread the Input (stdin) box; after its last line they get end-of-file (EOFError).- Before each run the program’s folder (
/home/pyodide, the current directory) is emptied and the files you added are written to it, soopen("data.csv")works. Each run starts with fresh variables in that clean folder, like runningpython3 main.pyagain. - Like the Python prompt, the value of the last line is shown as the result (
[2, 4, 6]).sys.exit(0)ends a program successfully; another exit status counts as an error.
What is not available
- Packages from PyPI —
pip install, numpy, pandas, requests — are not installed here; only the standard library is.import numpystops withModuleNotFoundError. - No windows or graphics:
tkinterandturtleneed a desktop and do not work in a browser. - No network sockets, so
urllib.request,http.clientandsocketcannot connect to servers, and there is nosubprocessoros.system.zoneinfohas no time-zone database here (use UTC offsets withdatetime.timezone). - Files your program writes stay inside the sandbox and are deleted before the next run; print the results to keep them.
Limitations
- Python compiled to WebAssembly runs somewhat slower than a native installation; very heavy computations are better run on your computer.
- A run is stopped after the time limit (10 seconds to 2 minutes); stopping restarts the interpreter, from your browser’s cache.
- Output is limited to 200,000 characters per run. Up to 50 files, 50 MB together, can be added.
- Your code and stdin (up to 300,000 characters each) are kept in this browser (local storage) for your next visit; Reset clears them. Added files are not kept.
Privacy
Everything happens in your browser. What you enter or open here is not uploaded or stored by MySmartCoPilot. The first time you press Run, Python itself (about 13.5 MB: the CPython interpreter and its standard library, compiled to WebAssembly) is downloaded from mysmartcopilot-sandbox.pages.dev, a separate MySmartCoPilot address; your browser keeps it for later visits. Your code, input and files are handed to it inside your browser and never uploaded.
Frequently asked questions
Which Python version is it?
CPython 3.14, as built by Pyodide 314.0.7. Run import sys; print(sys.version) to see the exact build.
Can I install packages with pip?
No. Only the standard library is available, because packages would have to be downloaded from a third-party server, which this site does not do. Most learning exercises and small scripts need nothing else.
How do I give my program input?
Type it into Input (stdin) before you run: each input() call reads the next line. If the program asks for more lines than you typed, it stops with EOFError: EOF when reading a line.
Is my code uploaded?
No. Your code, input and files go from this page to the sandbox frame inside your browser and run on your device. Only Python itself is downloaded, once.
Why is the first run slow?
The first run downloads the Python interpreter and standard library (about 13.5 MB) and starts it, which takes a few seconds on a good connection. Your browser keeps the files, so later runs — also on later visits — start almost at once.
Why did my program stop with a time-limit message?
It was still running when the time limit was reached — often a while loop whose condition never becomes false. Choose a longer limit next to the Run button if the work really takes longer.