Online Swift compiler
Compile and run Swift online free, no sign-up: write a Swift program, give it input with readLine() and see the output, errors and run time.
How do I run Swift code online?
This is an online Swift compiler that runs on Linux: write a Swift program, put its input in the Input box and press Run. It is compiled and run on the server, and you see what it printed, the compiler's errors or the crash, and the run time — free, with no sign-up.
How it works
- Write your program. A Swift program is top-level code run from the first line — no main function is needed. import Foundation for string helpers such as trimmingCharacters(in:) and String(format:); there is no UIKit or SwiftUI on a server.
- Give it input. readLine() returns the next line as an optional String?, nil once the input has run out. Split a line with split(separator: " ") and convert with Int(...), which is also optional. Put every line the program reads in the Input box before you run it.
- Run it. Press Run or Ctrl+Enter. You get what the program printed, any compiler or runtime error, and how long it ran. The first run without an account asks a quick check that you are a person.
Who it is for
Anyone writing Swift who wants it run now: a student checking a lab program or an exam answer, someone on a machine where nothing can be installed, or a learner trying Swift before setting it up.