What is a .kt file?
Kotlin Source File · Code and data · JetBrains · 2011
A .kt file is Kotlin source code, a concise, modern language that runs on the Java Virtual Machine and is now Google's preferred language for Android app development.
What is a .kt file used for?
Kotlin interoperates fully with Java but with less boilerplate and safer handling of null values. It compiles to JVM bytecode, and Android Studio uses it as the default language for new Android apps.
Beyond Android, Kotlin is used for server back ends and can even compile to native or JavaScript. The files are plain text; IntelliJ IDEA and Android Studio are the usual editors.
What opens a .kt file?
The .kt format opens in the following apps, grouped by operating system. If one app does not work, try another from the same list.
Windows
- IntelliJ IDEA
- Android Studio
- VS Code
macOS
- IntelliJ IDEA
- Android Studio
- VS Code
Linux
- IntelliJ IDEA
- Android Studio
- VS Code
Open a .kt file step by step
- Confirm the file really is a .kt. Drop it into the WhatFileType identifier, which reads its signature in your browser without uploading anything.
- On Windows, open it with IntelliJ IDEA or Android Studio.
- On Mac, use IntelliJ IDEA or Android Studio.
- On Linux, try IntelliJ IDEA or Android Studio.
- Still stuck? Convert the .kt to class (bytecode), which opens more widely.
Why can't I open my .kt file?
Almost always because no installed app understands Kotlin. Install one of the apps above, or convert the file to a format your existing software already reads. If double-clicking opens the wrong program instead of nothing at all, the file association is set to the wrong app rather than the file being broken.
The other possibility is that the file is not really a .kt at all. Drop it into the file identifier to check it by its bytes instead of its name. Nothing is uploaded.
How to convert a .kt file
You can convert a .kt file to class (bytecode), jar using a conversion tool or the export menu of an app that opens it.
Kotlin has no fixed magic number, so there is no signature table on this page. Its bytes alone do not prove the format: identification relies on the extension, the structure of the content and the program that created it. The magic-numbers reference lists the formats that do carry one.
Frequently asked questions
What is a .kt file?
A .kt file is Kotlin source code, a concise, modern language that runs on the Java Virtual Machine and is now Google's preferred language for Android app development.
How do I run a .kt file?
Compile with kotlinc file.kt then run on the JVM, or build it inside IntelliJ IDEA or Android Studio.
Is Kotlin better than Java for Android?
Google recommends Kotlin for new Android apps because it is more concise and safer around null values, while still working with existing Java code.
How do I open a .kt file?
Any text editor shows the source. IntelliJ IDEA or Android Studio add full Kotlin tooling.
Related formats
Sources
Details on this page were checked against authoritative references. How sources are ranked and what is deliberately left out is set out in the methodology.