How to Run Python on iPhone Offline
To run Python on an iPhone or iPad offline, install an app that bundles a Python interpreter on the device: Pocket Compiler: Run Code is free and runs Python, JavaScript, HTML and SQL with no internet and no account. Pythonista, Juno and a-Shell are other on-device options; Replit runs your code in the cloud instead.
Why you need an app
iOS does not ship a Python interpreter you can reach from the home screen, and Safari cannot run a .py file. So the choice is between an app that carries Python inside it (works offline) and a cloud service that runs the code on a server (needs a connection).
Your options on iPhone and iPad
| App | Runs on the device | Price model | Good for |
|---|---|---|---|
| Pocket Compiler: Run Code | Yes: Python, JavaScript, HTML, SQL | Free to download; some features are part of an optional upgrade | Exercises, scripts, trying code from a video or book, several languages in one app |
| Pythonista | Yes: Python | Paid | Python-only scripting with iOS integrations |
| Juno | Yes: Python in Jupyter notebooks | Paid | Notebook-style data work |
| a-Shell | Yes: a terminal with Python | Free | People who like the command line |
| Replit | No, runs in the cloud | Free tier and paid plans | Projects you also open on a computer; needs internet and an account |
What Pocket Compiler does on iPhone
- Python, JavaScript, HTML and SQL run on the device, offline, from the moment you install. There is no run counter.
- Program input: type what your program reads with
input(), then run. Class exercises that ask for input work. - Errors point to the line. Tap an error to jump to it.
- HTML opens as a live page with its CSS and script. SQL shows its results as a table.
- Opens files from the Files app or with "Open in" from another app:
.py,.js,.html,.sql, plus TXT, JSON, CSV, Markdown and more. - No account. Your code stays on your device.
Version 2.1 of the iPhone app (in App Store review as of November 2026) adds GitHub browsing and cloning, a built-in terminal, pure-Python package installs from a requirements.txt, and the Code Library of programs from our Shorts.
What it does not do on iPhone
- No Java, C, C++ or PHP on iPhone and iPad. (Java is free and C, C++ and PHP are Pro in the Android app.)
- Package installs on iPhone are pure-Python only, so packages with compiled parts may not be available there.
- Free runs stop at 5 seconds (20 seconds with Pro), so long jobs are not a fit.
- The free version shows ads.
How to run a Python file offline on iPhone
- Install Pocket Compiler: Run Code from the App Store while you have a connection.
- Turn on Airplane mode if you want to prove it works offline.
- Create a new file named
main.py. - Type:
name = input("Your name: ")
print("Hello,", name)
print(0.1 + 0.2)
- Type your name in the input box and tap ▶ Run.
- You will see the greeting, then
0.30000000000000004. That second line is a real floating-point quirk, and it is the subject of one of our Shorts (code P2).
Tips for Python on a phone
- Keep scripts short and print often: output appears when the program finishes.
- If a loop never ends, the app stops it at the time limit, so it stays usable.
- Use a hardware keyboard on iPad if you write a lot; the key bar above the on-screen keyboard covers brackets, quotes and indentation.
Frequently Asked Questions
Can I run Python on iPhone without internet?
Yes. Pocket Compiler, Pythonista, Juno and a-Shell all run Python on the device. Replit needs a connection.
Is there a free Python app for iPhone?
Pocket Compiler is free to download and run Python with ads; a-Shell is also free. Pythonista and Juno are paid.
Can I use numpy on iPhone?
In Pocket Compiler on iPhone, package installs are pure-Python only. On Android, Pocket Compiler installs numpy and pandas from a requirements.txt.
Does it work on iPad?
Yes. Pocket Compiler runs on iPhone and iPad.
Is my code uploaded?
No. Your code is stored and run on your device.
See screenshots, the language list and free-vs-Pro details on the Pocket Compiler page. It is also on Google Play for Android.