Online Kotlin Compiler
Compile and run Kotlin online with Kotlin 2.4. Write your program in main.kt, press Run, and it is compiled with kotlinc and started on Java 21, with compiler errors and output shown beside your code. The build takes a few seconds, and programs can read input with readln.
How to run Kotlin code online
- This page opens with Kotlin selected, so you can start typing straight away.
- Write your code in the editor, or open files from your computer: single files, or a whole project as a .zip.
- Press Run, or Ctrl+Enter. The output appears in the panel beside the editor, and when the program asks for input you type it there and press Enter.
- Share a copy with a link, or save your files to your computer.
Kotlin 2.4 on Online IDE
- The file in the active tab is compiled with kotlinc and run on Java 21, so the build takes a few seconds before the program starts.
- Your file needs a fun main(). Kotlin's standard library and the Java class library are both available.
- readln() reads a line of input: type it in the output panel and press Enter. Call System.out.flush() after print() so a prompt shows before you type.
- The build compiles one file, so keep a program in a single tab.
Example: a Kotlin program that reads input
fun main() {
print("Enter some words: ")
System.out.flush()
val words = readln().split(" ").filter { it.isNotBlank() }
val longest = words.maxByOrNull { it.length }
println("You typed ${words.size} words. The longest is \"$longest\".")
}
Features of this tool
- Simple and fastA clean, lightweight editor that opens instantly.
- Powered by AceThe Ace code editor, with syntax highlighting, autocompletion and bracket matching.
- Interactive programsType input into the terminal while your program runs.
- Several filesWork in tabs, open files or a .zip from your computer, and save the project back to disk.
- Made for learningHelpful for beginners to learn and practice programs.
- Light and dark themesPlus 39 editor themes, a choice of coding fonts, and Vim, Emacs or VS Code keys.
- Keep your outputCopy or download the program output in one click.
- Share by linkSave your code in the cloud and open it anywhere.
Frequently asked questions
Which Kotlin version does Online IDE use?
Kotlin 2.4, compiled with kotlinc and run on Java 21, on Linux.
Why does Kotlin take a few seconds to start?
kotlinc is a large compiler that starts again for every run, so the build takes a few seconds before your program begins.
Can a Kotlin program read input?
Yes. Use readln() or readLine(), then type into the output panel while the program waits and press Enter.
Can I use more than one Kotlin file?
No. Only the file in the active tab is compiled, so put the whole program in that one file.
Contact us
For any feedback, queries or issues, please feel free to contact us or write to . We value your input and are committed to providing the best possible experience for our users.