Theoretically, coding can be done on almost any device with internet access and the possibility to connect a keyboard or type via a touchscreen, including mobile devices such as your phone or tablet. However, this is more of a theoretical question as coding on mobile devices isn’t the most convenient method of writing code and should only be done if you haven’t got access to a proper computer.
Nonetheless, I want to explain how coding on mobile devices is possible using the right apps and services out there.
Keep reading if you want to find out more!
Coding on Mobile: How to do it
There are even multiple ways to write code on a phone or tablet. You could save and run the code locally on your mobile device, connect to your laptop or PC via remote access, or connect to a cloud machine. Because all those methods have their benefits and use cases, I will give you an overview along with some examples of services you could use.
Saving and running code locally
Even though modern mobile devices are easily capable of running any code, this method of coding on mobile phones or tablets is the least useful one. It should only be used for writing simple code, as the available development environments and the operating system will restrict the use of most third-party libraries and more complex capabilities of the programming languages.
Additionally, you may encounter performance issues fairly quickly compared to a PC or laptop.
If you still want to give this a shot, you can simply search for the programming language you want to use on the app store.
Theoretically, you could also try to root your android phone to gain full control over the operating system and use it like a small Linux computer. However, I strongly recommend not rooting your phone as it can be permanently damaged software-wise.
Remote access to your own computer
If you want to be able to use all libraries and capabilities of a programming language without any limitations, it only makes sense to connect to a proper computer via remote access.
If you’ve got a Linux computer, it’s probably the best idea to use SSH (Secure Shell) in order to access the terminal of your computer and use a text editor like Nano or Vim.
However, if you prefer writing code locally on your phone, you can download an app with syntax highlighting and autocomplete and later upload the code to your computer via FTP to run it.
For SSH and FTP access, I recommend the app Terminus. The basic features are free, the app is easy to use, and it is available on both Android and iOS.
Of course, you can use SSH and FTP for Windows and Mac too. However, most Windows and Mac users prefer their well-known graphical interface, and depending on your project you will even need it. Therefore, it’s the best idea to use a graphical remote access service to connect to your Windows or Mac computer using your mobile device. Keep in mind though that you’ll need a keyboard and a mouse connected to your mobile device to interact with your computer.
The graphical remote access service I recommend is Parsec. Parsec is available on all operating systems (also Linux). You just have to install Parsec on your Computer and your mobile device.
Remote access to cloud machines
Similar to connecting to the computer you’ve got at home, you can also connect to a computer in the cloud. However, there are multiple options for coding on mobile devices using cloud computers.
Renting a server
If you don’t have a computer or you need more power, you can also just rent one. Using your mobile devices to connect to that server works basically the same way as explained in the part above. The only difference is that the computer is not at your home or workplace.
I am not going to give you a recommendation for a hosting service, as there are so many good ones. Simply pick the one that fulfills your needs for the best price.
Using online code editors
Again, there’s more than one type of online code editor.
If you want to test a short snippet of code and don’t need a powerful computer, you can simply use the search engine of your choice to search for a simple online code editor like the one from Programiz. Try searching for something like “<programming language> online editor”
Usually, these simple online code editors don’t allow you to use third-party libraries and don’t offer a lot of performance.
However, if you do need more performance and the option to use more libraries, you can use proper online development environments like Google Colab or JupyterLab. Unfortunately, those two examples mainly work with Python and there aren’t many great alternatives for other languages.
Coding on mobile using GitHub Codespaces (only tablets)
My personal favorite option for coding on my tablet (which rarely happens) is GitHub Codespaces. The codespaces are powerful and fully functional cloud machines. Basically, you can start a codespace from any repository on GitHub.
If you start a codespace, a new tab will open in your browser with an online version of VS Code. Also, you can use the terminal to execute code, install libraries, etc.
If you are interested, have a look at all the amazing features of the codespaces on GitHub’s official page.
Is coding on mobile possible?
Yes it is. You can save and run code locally, connect to your computer via remote access, or use computers in the cloud. All of those methods come with their own up- and downsides.
Even though there are a ton of options for coding on mobile devices, you should avoid coding on your phone or tablet. All those services aren’t even meant for this use case. However, if you have no other choice than to write some code on your phone (for whatever reason) or you were just interested, you now know how to do it.