Kotlin Get Started
You can start writing Kotlin in minutes using the browser-based Kotlin Playground, or set up a full IDE like IntelliJ IDEA or Android Studio for real projects.
Three Ways to Run Kotlin
There is no single correct way to start writing Kotlin. If you just want to try a small snippet, the Kotlin Playground runs entirely in your browser. If you're building a real application, an IDE like IntelliJ IDEA or Android Studio gives you code completion, debugging, and project management. If you prefer the terminal, you can install the Kotlin compiler and run it from the command line.
- Kotlin Playground - write and run code instantly in your browser, no installation required
- IntelliJ IDEA - JetBrains' flagship IDE, with Kotlin support built in from day one
- Android Studio - the official IDE for Android apps, built on top of IntelliJ IDEA
- Command-line compiler (kotlinc) - compile and run .kt files directly from a terminal
Try the Kotlin Playground
Open play.kotlinlang.org in any browser, type or paste Kotlin code into the editor, and click Run. The Playground compiles your code on JetBrains' servers and shows the output right below the editor, making it perfect for quick experiments and for following along with a tutorial like this one.
Hello, Playground
fun main() {
println("Running in the Kotlin Playground!")
}Install an IDE or Use the Command Line
For real projects, download IntelliJ IDEA Community Edition (free) or Android Studio, both of which bundle the Kotlin plugin by default. Create a new project, choose Kotlin as the language, and click the green run arrow next to fun main() to execute it. If you prefer the terminal, install the Kotlin compiler with a tool like SDKMAN (sdk install kotlin) or Homebrew (brew install kotlin), then compile a file with kotlinc HelloWorld.kt -include-runtime -d HelloWorld.jar and run it with java -jar HelloWorld.jar.
A Typical IDE-Generated Program
fun main() {
val projectName = "My First Kotlin App"
println("Welcome to $projectName")
}A Program Ready to Compile
fun greet(name: String): String {
return "Hello, $name! Welcome to Kotlin."
}
fun main() {
println(greet("Developer"))
}Exercise: Kotlin Get Started
What file extension do Kotlin source files use?