Hello, World!
fun main() {
println("Hello, World!")
}Tap Run to execute
Main.kt · output appears here
Press Run to execute
Output streams here as your program runs.
Kotlin is a statically typed, general-purpose programming language developed by JetBrains, with its first stable release (1.0) in 2016. It runs on the Java Virtual Machine and is fully interoperable with Java, while offering concise syntax, null safety, and support for both object-oriented and functional programming paradigms.
Kotlin is Google's preferred language for Android app development and is also used for server-side applications, web (via Kotlin/JS), and multiplatform projects. Its expressive syntax, coroutines for asynchronous programming, and strong tooling make it popular for building modern, maintainable applications across mobile and backend.
Main.kt is the entry point. Add helper files from the explorer and import them into your project.
Use the Input panel to pipe standard input to your program when it needs data.
Run sends your code to a fresh hosted runtime and streams the result into the output panel.
Your draft stays in this browser, and Share creates a separate snapshot link.
Kotlin tabs compile together, so Main.kt can call a top-level helper declaration.
fun main() {
println(answer())
}
fun answer(): Int = 42
fun main() {
println("Hello, World!")
}fun main() {
print("Enter your name: ")
val name = readLine()
println("Hello, $name!")
}fun main() {
val fruits = listOf("apple", "banana", "cherry")
for ((i, fruit) in fruits.withIndex()) {
println("${i + 1}: $fruit")
}
}fun factorial(n: Int): Long =
if (n <= 1) 1 else n * factorial(n - 1)
fun main() {
println(factorial(5))
}fun main() {
try {
val n = "abc".toInt()
println(n)
} catch (e: NumberFormatException) {
println("Invalid number: ${e.message}")
} finally {
println("Done")
}
}fun main() {
val counts = mutableMapOf<Char, Int>()
for (c in "banana") {
counts[c] = (counts[c] ?: 0) + 1
}
for ((ch, n) in counts) {
println("$ch: $n")
}
}fun main() {
val nums = listOf(3, 1, 4, 1, 5)
val doubled = nums.sorted().map { it * 2 }
println(doubled)
println("Sum: ${nums.sum()}")
}data class Person(val name: String, val age: Int) {
fun describe() = "$name ($age)"
}
fun main() {
val p = Person("Ada", 36)
println(p.describe())
}sealed class Shape
class Circle(val r: Double) : Shape()
class Square(val side: Double) : Shape()
fun area(s: Shape): Double = when (s) {
is Circle -> 3.14159 * s.r * s.r
is Square -> s.side * s.side
}
fun main() {
println(area(Square(3.0)))
}fun String.shout() = this.uppercase() + "!"
fun main() {
println("hello".shout())
}The editor uses Monaco, the engine behind VS Code, with language-aware editing tools and familiar keyboard controls.
Type or paste your code into the editor, then click Run (or press Ctrl/Cmd + Enter) to execute it.
Output streams into the console panel, including runtime errors, exit status, and execution time.
Nothing to install and no account to create — code runs in an isolated hosted runtime.
Language-aware autocomplete and IntelliSense suggestions where the editor has a matching language service
Syntax highlighting, with native compiler and runtime errors shown in the console
Bracket matching, auto-indentation, code folding, and a minimap
Multi-cursor editing plus find & replace (Ctrl/Cmd + F)
Full undo/redo history and copy to clipboard
Built on Monaco — the same editor that powers VS Code
Run on demand, or turn on Auto-run to execute on every change
Stop long-running or infinite programs at any time
A real console shows standard output, errors, exit status, and execution time
Pass standard input (stdin) to your program from the Input panel — one value per line
Switch between light and dark themes
Adjust font size and other editor settings
Toggle side-by-side or top/bottom layouts
Enter distraction-free fullscreen mode
Generate a shareable link to your exact code in one click — no login needed
Your work autosaves to your browser, so you can pick up where you left off
Copy the active file to your clipboard
Run code: Ctrl/Cmd + Enter
Find & replace: Ctrl/Cmd + F
Open the full shortcut list from the keyboard icon in the toolbar
Kotlin is one of 23 linked-project compilers. Run always starts Main.kt; selecting a helper tab changes what you edit, not the entry file.
Kotlin tabs compile together, so Main.kt can call a top-level helper declaration.
Linked-project languages (23): Node.js, TypeScript, Deno, Python, C, Go, Dart, Swift, Rust, Ruby, PHP, Java, Kotlin, C++, C#, Nim, Crystal, Haxe, Zig, Scala, D, Bun, Objective-C.
Single-file scratchpads (46): Matplotlib, NumPy, pandas, Haskell, Clojure, Perl, Lua, Tcl, jq, Raku, Elixir, Bash, Zsh, Nushell, R, Assembly (NASM), Julia, Octave, Groovy, PowerShell, Visual Basic .NET, Odin, Pascal, Lisp, Erlang, CoffeeScript, COBOL, BASIC, V, Racket, OCaml, Prolog, AWK, Emacs Lisp, Emojicode, Forth, F#, Fortran, Assembly (NASM64), Solidity, Mojo, Ada, WASM (WAT), Gleam, Shell Script (sh), Scheme. Their extra project files are not submitted to the runtime.
Download project exports every Kotlin tab and a README in one ZIP archive.