Using IntelliJ IDEA Scratch Files for Temporary Code, Data, and Quick Prototyping
This article explains how IntelliJ IDEA's Scratch Files and Scratch Buffers let developers quickly create, edit, run, and debug temporary code snippets, JSON, HTTP requests, and other text without leaving the current project, improving productivity and avoiding context switching.
When developing in IntelliJ IDEA you may need to quickly jot down pseudo‑code, JSON data, HTML/CSS/SQL snippets, HTTP client calls, or switch to another project idea; opening separate editors for each can be cumbersome and memory‑intensive.
IntelliJ IDEA provides a built‑in feature called Scratch Files (temporary files) and Scratch Buffers (simple text buffers) that allow you to create and work with temporary content without tying it to any project.
Scratch Files are fully‑featured files that support syntax highlighting, code completion, execution, debugging, and local history. They are stored locally (not in the project) and can be accessed across projects, making them ideal for quick Java code, HTTP requests, JSON documents, and more.
Scratch Buffers are plain text notes without language assistance, useful for simple notes or task lists. Up to five buffers (buffer1.txt … buffer5.txt) can be created and reused; additional buffers overwrite the oldest after confirmation.
To create a Scratch File, use File → New → Scratch File , the shortcut Ctrl+Alt+Shift+Insert , or select code and press the shortcut to let IDEA infer the appropriate file type.
To create a Scratch Buffer, invoke the Find Action ( Ctrl+Shift+A ) and type “new scratch buffer”. The default names are buffer1.txt through buffer5.txt , and you can rename them to keep more than five.
Scratch Files support most programming languages, provide syntax highlighting, code completion, run/debug icons, and local history for rollback. They also allow cross‑project access, renaming, moving, deleting, and copying.
Overall, Scratch Files and Buffers help developers avoid frequent context switches, keep temporary work organized, and improve development efficiency.
Architect's Guide
Dedicated to sharing programmer-architect skills—Java backend, system, microservice, and distributed architectures—to help you become a senior architect.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.