<html><head><link rel="canonical" href="https://www.jetbrains.com/help/idea/run-kotlin-interactively.html.md/" data-react-helmet="true"/></head><body># Run Kotlin interactively

&gt; **TL;DR**
&gt; Required plugin: Kotlin (bundled)

IntelliJ&nbsp;IDEA provides several ways to execute code snippets outside a project. This is useful when you need to quickly evaluate some code fragment, test some scenario, or prototype an improvement.

## Scratches

Scratches allow you to create a temporary file and execute it straight away. This is useful for testing and prototyping purposes.

Scratches are independent of projects. They can be accessed from any project, but you have to specify where to look for the classes in case you are using project-specific classes.

Procedure: Create a scratch

* In the main menu, go to `File | New | Scratch File` or press `Ctrl+Alt+Shift+Insert` (Windows), `⌘ ⇧ N` (macOS), `⌃ ⇧ N` (IntelliJ IDEA Classic (macOS)), `⌃ ⇧ N` (macOS System Shortcuts), `Ctrl+Alt+Shift+Insert` (XWin), `Ctrl+Alt+Shift+Insert` (GNOME), `Ctrl+Alt+Shift+Insert` (KDE), `Ctrl+Alt+Shift+Insert` (Emacs), `Ctrl+Alt+Shift+Insert` (Sublime Text), `⌘ ⇧ N` (Sublime Text (macOS)), `Ctrl+Alt+Shift+Insert` (NetBeans), `Ctrl+Alt+Shift+Insert` (Visual Studio), `⌘ ⇧ N` (Visual Studio (macOS)), `Ctrl+Alt+Shift+Insert` (Eclipse), `⌘ ⇧ N` (Eclipse (macOS)), then select Kotlin.

Procedure: Run a scratch

* In the top-left corner of the editor, click ![the Run button](https://resources.jetbrains.com/help/img/idea/2026.2/app-client.expui.gutter.run.svg) or press `Ctrl+Alt+W` (Windows), `⌘ ⌥ W` (macOS), `⌘ ⌥ W` (IntelliJ IDEA Classic (macOS)), `⌘ ⌥ W` (macOS System Shortcuts), `Ctrl+Alt+W` (XWin), `Ctrl+Alt+W` (GNOME), `Ctrl+Alt+W` (KDE), `Ctrl+Alt+W` (Emacs), `Ctrl+Alt+W` (Sublime Text), `⌘ ⌥ W` (Sublime Text (macOS)), `Ctrl+Alt+W` (NetBeans), `Ctrl+Alt+W` (Visual Studio), `⌘ ⌥ W` (Visual Studio (macOS)), `Ctrl+Alt+W` (Eclipse), `⌘ ⌥ W` (Eclipse (macOS)).

The following options are available for running Kotlin scratches:

* Use classpath of module (only applicable for scratches): specifies the module with your custom classes if you want to use them in a scratch.

* Interactive mode: runs the code each time you stop typing.

</body></html>