How to Use input() in an Online Python Compiler
By Durim Hoti · Last updated
When Python runs on a server, a program can't wait for your keystrokes, so all input has to be given before the run, and a missing line ends in an EOFError. Here Python runs in your browser, so the program can really wait for your answer.
Run a program with input() step by step
- Open the online Python compiler and paste or write your program.
- Click Run (or press Ctrl+Enter). Python is downloaded in the background when the page opens; if it isn't ready yet, the status shows the progress.
- When the prompt appears, type your answer in the field under the output and press Enter. Repeat for each
input(). - To stop answering, click End input (or press Ctrl+D in the field), or click Stop to end the program.
- For repeated test runs, put the answers in Input (stdin), one per line, so you don't have to type them every time.
Example: two questions and an answer
name = input("Your name: ")
age = int(input("Your age: "))
print(f"Hi {name}, next year you will be {age + 1}.")After Run, the program printed the first prompt and waited. We typed Anna, then 29:

Your name: Anna
Your age: 29
Hi Anna, next year you will be 30.With Input (stdin) set to these two lines, the same program ran through without stopping and printed exactly the same output:
Anna
29Common problems
ValueError: invalid literal for int()
int() only accepts digits. Typing "twenty" at the second prompt gave:
Your name: Anna
Your age: twenty
Traceback (most recent call last):
File "main.py", line 2, in <module>
age = int(input("Your age: "))
ValueError: invalid literal for int() with base 10: 'twenty'Ask again until the input is a number:
while True:
try:
age = int(input("Your age: "))
break
except ValueError:
print("Please enter a whole number.")EOFError: EOF when reading a line
The input ended before input() got a line. Clicking End input at the first prompt gave:
Your name: Traceback (most recent call last):
File "main.py", line 1, in <module>
name = input("Your name: ")
EOFError: EOF when reading a lineIf your browser can't pause a running program, the compiler uses only the Input (stdin) box and explains instead of showing the traceback: Your program called input(), but the Input (stdin) box has no line left for it. Type one line per input() call in the box above, then press Run again.
Several values on one line
input() reads a whole line. Split it yourself:
a, b = map(int, input("Two numbers: ").split())
print(a + b)The prompt doesn't appear right away
Python may still be downloading when you first press Run; the status shows the progress, and the program starts when Python is ready. Later runs start immediately.
What to do next
Writing web pages instead of scripts? See how to run HTML, CSS and JavaScript online. If your Python program reads JSON and fails, our guide on fixing JSON errors explains the messages.
FAQ
- Why does my program stop at input()?
- It is waiting for you. A field appears under the output with the text "Your program is waiting for input"; type the answer and press Enter. The status next to Output shows "Waiting for input…" meanwhile.
- What does EOFError: EOF when reading a line mean?
- input() asked for a line but the input had ended, for example because you clicked End input (or pressed Ctrl+D) or because the Input (stdin) box had no line left. Answer the prompt instead, or add one more line to the box.
- Can I give all inputs at once?
- Yes. Open Input (stdin) above the output and type one line per input() call before pressing Run. The program then reads the lines in order without stopping.
- Which Python version runs in the browser?
- In our test the compiler ran Python 3.13.2 (Pyodide), downloaded once from a CDN and then run on your device. Your code isn't sent to a server.
- Can I read several values from one line?
- Yes, with split(): a, b = map(int, input().split()) reads two numbers separated by a space. This is standard Python and works the same way in the browser.
Try it and keep reading
- Open the Python online compilerRun Python 3 code in your browser with instant output.
- How to Run HTML, CSS and JavaScript OnlineWrite HTML, CSS and JavaScript in the browser, see the result, and read the errors when it doesn't work.
- How to Fix JSON Errors Like "Unexpected token"Understand JSON error messages, find the exact spot, and fix the nine most common mistakes.