Kotlin compiler

Online Kotlin compiler for real Kotlin/JVM projects

Write fun main(), press Run and the Kotlin compiler builds it for the JVM. Choose the Kotlin version and the JDK per project, mix Kotlin with Java and keep the code in a project you can come back to.

  • kotlinc · Maven · Gradle
  • Kotlin version per project
  • Free, nothing to install
fun main() {
    print("How many numbers? ")
    val count = readln().toInt()
    val squares = (1..count).map { it * it }
    println("Squares: $squares")
    println("Sum: ${squares.sum()}")
}

Press Shift+F10 on fun main(), type a number and press Enter.

Built on the tools Java and Kotlin developers already trust

Java 8 Java 11 Java 17 Java 21 Java 25 Kotlin 2 Maven Gradle Gradle Kotlin DSL Maven Central JUnit 5 Eclipse JDT google-java-format Step debugger
Kotlin compiler

What you get

Compile and run Kotlin online with kotlinc, Maven or Gradle Kotlin DSL. Completion, KDoc, a debugger and JUnit 5 tests in a free browser IDE. Nothing to install.

  • Three ways to build

    IntelliJ projects use kotlinc directly, Maven projects the kotlin-maven-plugin and Gradle projects the Kotlin Gradle plugin with build.gradle.kts.

  • Kotlin version per project

    Pick the Kotlin version when you create the project, together with the JDK it runs on.

  • An editor that knows Kotlin

    Highlighting, completion, KDoc, Go to Declaration, Find Usages, Rename and Reformat Code work in every .kt file.

  • Java interop

    In IntelliJ and Gradle projects Kotlin calls your Java classes and Java calls Kotlin, in the same source tree.

  • Debug and test

    Set breakpoints in .kt files, step through the code line by line and run JUnit 5 tests from the gutter.

  • Same sandbox as Java

    Kotlin programs run isolated, read input with readln() and print to the same interactive console.

How it works

Under the hood

  1. 01

    From a script to a project

    Start with a single Main.kt in an IntelliJ project and the code is compiled with kotlinc and run on the JVM. When it grows, switch to Gradle with the Kotlin DSL or to Maven and add libraries such as kotlinx.coroutines from Maven Central.

  2. 02

    Kotlin and Java side by side

    New → Kotlin Class/File and New → Java Class sit next to each other in the project menu. Navigation, Find Usages and Rename follow calls across both languages, so migrating a Java class to Kotlin does not mean leaving the IDE.

FAQ

Questions, answered

Is the online Kotlin compiler free?

Yes. Create a free account and start a Kotlin project; there is nothing to buy or install.

Which Kotlin version is used?

The one you choose for the project when you create it. Maven and Gradle projects build with the matching Kotlin plugin.

Does readln() work?

Yes. The Run console sends what you type to the program, so readln(), readLine() and System.in all work.

Can I use Kotlin libraries?

Yes. In Maven and Gradle projects declare dependencies such as kotlinx.coroutines and they are downloaded from Maven Central on the next build.