Skip to content
Online Compiler

Online Python Compiler

Write Python 3 and run it right here. Python runs inside your browser, so nothing you type is uploaded. The first run downloads the runtime.

Ready

# input() reads one line from the input box.
name = input("What is your name? ")
print(f"Hello, {name}!")

for i in range(1, 4):
    print(i, "squared is", i * i)

Type the input before you run. Each input() call reads the next line.

Output

Press Run or Ctrl+Enter to see the output here.

Runs in your browser with Python 3.14 (Pyodide 314.0.8). Your code is not sent to a server.

How to run Python code here

  1. Write or paste your Python code into the editor. There is a short example in it to start from.
  2. If your program reads input, type it into the input box first — one value per line.
  3. Press Run or Ctrl+Enter. The output appears next to the editor, with errors shown in red.

How this page runs Python

Runtime: Python 3.14 (Pyodide 314.0.8)

Python runs through Pyodide 314.0.8, a build of CPython 3.14 for WebAssembly. The first time you run code the browser downloads the runtime — about 12 MB — from the jsDelivr CDN, and later visits load it from the browser cache. The standard library comes with it: math, random, datetime, collections, itertools, functools, json, re, dataclasses, typing and more. Errors are printed as a normal Python traceback that points at main.py.

Everything happens on your device. The code you write is never uploaded, logged or stored on a server. Each run stops after 10 seconds and keeps up to 100,000 characters of output, so an endless loop cannot freeze the page.

What is not available

Packages from PyPI such as NumPy or pandas are not installed, and programs cannot open windows (tkinter, turtle) or reach files on your computer. Every run starts with fresh variables; modules you have imported stay cached for the next run so they load faster.

Python examples

Open an example in the editor above, change it and run it. Opening an example does not run it.

FizzBuzz with range

for i in range(1, 16):
    word = ("Fizz" if i % 3 == 0 else "") + ("Buzz" if i % 5 == 0 else "")
    print(word or i)

List comprehensions, sorted and max

numbers = [5, 3, 8, 1, 9, 2]

squares = [n * n for n in numbers]
evens = [n for n in numbers if n % 2 == 0]

print("squares:", squares)
print("evens:", evens)
print("sorted:", sorted(numbers, reverse=True))
print("max:", max(numbers), "sum:", sum(numbers))

Counting words from the input

import sys
from collections import Counter

text = sys.stdin.read().lower()
words = [w.strip(".,!?") for w in text.split()]
for word, count in Counter(words).most_common(3):
    print(f"{word}: {count}")

Input

the cat and the dog.
The end!

A dataclass with a property

from dataclasses import dataclass, field


@dataclass
class Cart:
    items: dict[str, float] = field(default_factory=dict)

    def add(self, name: str, price: float) -> "Cart":
        self.items[name] = price
        return self

    @property
    def total(self) -> float:
        return round(sum(self.items.values()), 2)


cart = Cart().add("tea", 3.5).add("cake", 4.25)
print(cart)
print("total:", cart.total)

Raising and catching exceptions

def parse_age(text: str) -> int:
    age = int(text)
    if age < 0:
        raise ValueError("age cannot be negative")
    return age


for raw in ["42", "-1", "abc"]:
    try:
        print(raw, "->", parse_age(raw))
    except ValueError as error:
        print(raw, "-> error:", error)

Reading input in Python

Programs here do not stop and wait for you to type while they run. Everything your program reads comes from the input box, which you fill in before pressing Run.

input() reads the next line from the input box, and input("Prompt: ") prints the prompt first. sys.stdin.read() returns all of the input at once, and for line in sys.stdin loops over it line by line. When the input is used up, input() raises EOFError.

Saving and sharing

Your latest Python code and input are saved automatically in this browser, so they are still here when you come back. Nothing is saved on a server.

Share creates a link that carries your code inside the address itself, compressed after the # sign. Whoever opens it sees your code in the editor, and it only runs when they press Run.

Keyboard shortcuts

KeysAction
Ctrl+EnterRun the code
Ctrl+/Comment or uncomment the line
Tab · Shift+TabIndent or outdent the selection
Ctrl+FFind and replace in the code
Ctrl+Z · Ctrl+Shift+ZUndo / redo
Esc → TabLeave the editor with the keyboard

On a Mac, use ⌘ instead of Ctrl.

Frequently asked questions

Which Python version does this compiler use?

Python 3.14, provided by Pyodide 314.0.8. The version is shown under the editor, and it only changes when this site is updated.

Can I use NumPy, pandas or pip install?

Not yet. Only the standard library is available, which covers most exercises, interview questions and scripts. There is no pip, so third-party packages cannot be installed.

Why is the first run slower?

Python itself has to be downloaded into your browser before the first run — about 12 MB. It starts loading as soon as you click into the editor, and once it is ready, runs take only as long as your code does.

Is this Python compiler free?

Yes. There is no account, no sign-up and no daily limit. The only limit is that a single run stops after 10 seconds.

Is my Python code sent to a server?

No. The Python runtime is downloaded into your browser and your code runs there, on your device. The site only serves the page and the runtime files; it never receives the code you write or the input you give it.

Where is my code saved?

In this browser's local storage, one draft per language. It stays until you clear this site's data, and it is not synced to other devices. Use a share link to move code somewhere else.

How do I share my Python code?

Press Share and send the copied link. The code is compressed into the part of the link after #, which browsers never send to a server. Very long programs do not fit in a link, and the page will tell you when that happens.

Does it work on a phone or tablet?

Yes. It runs in any current mobile browser. On a slow connection the first run takes longer because the runtime has to be downloaded once.

Run another language