# Code Folding

> **TL;DR**
> `File | Settings | Editor | General | Code Folding` for Windows and Linux
>
>
>
> `IntelliJ IDEA | Settings | Editor | General | Code Folding` for macOS
>
>
>
> `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) ![the Settings icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.general.settings.svg)

Use this page to specify the default code folding settings. For shortcuts on how to expand or collapse code elements, refer to the [code folding](working-with-source-code.html#code_folding)  section.

| Item | Description |
| --- | --- |
|  Show code folding arrows |    Display code folding icons in the editor.     From the list, select the way in which the icons for unfolded areas should be displayed:       * Always: code folding icons are always displayed in the gutter.    * On mouse hover: code folding icons appear only when you hover over the gutter.      ![Code folding](https://resources.jetbrains.com.cn/help/img/idea/2026.2/new_ui_code_folding.animated.gif)                                            Show bottom arrows: display the bottom folding arrows in the gutter as well. Otherwise, only the top arrows are shown.    |
|  Fold by default |    Select the code fragments that should be folded by default, that is, when a file is first opened in the editor.        * File header    * [Imports](creating-and-optimizing-imports.html)    * [Documentation comments](javadocs.html)    * Method bodies    * Custom folding regions: blocks of code within matched pairs of curly braces `{}`, learn more from [Expand or collapse code elements](working-with-source-code.html#expand-or-collapse-code-elements). For example, select a block of code for which you want to create a folding region, press `Ctrl+Alt+T` (Windows), `⌘ ⌥ T` (macOS), `⌘ ⌥ T` (IntelliJ IDEA Classic (macOS)), `⌘ ⌥ T` (macOS System Shortcuts), `Ctrl+Alt+Shift+B` (XWin), `Ctrl+Alt+Shift+B` (GNOME), `Ctrl+Alt+Shift+B` (KDE), `Ctrl+Alt+T` (Emacs), `Ctrl+Alt+T` (Sublime Text), `⌘ ⌥ T` (Sublime Text (macOS)), `Ctrl+Alt+T` (NetBeans), `Ctrl+Alt+T` (Visual Studio), `Ctrl+Alt+T` (Visual Studio (macOS)), `Alt+Shift+Z` (Eclipse), `⌘ ⌥ Z` (Eclipse (macOS)), select either `<editor fold>` or `region...endregion` comments depending on the style you need, and name the created custom region. Now, when you select the Custom folding regions option, IntelliJ IDEA will fold such regions when you open your file in the editor. Unfolded: ![Custom region](https://resources.jetbrains.com.cn/help/img/idea/2026.2/before_collapsed_region.png) Folded: ![Folded custom region](https://resources.jetbrains.com.cn/help/img/idea/2026.2/after_collapsed_region.png)    * Android: language-specific code fragments in Android    * JavaScript: language-specific code fragments in JavaScript and TypeScript    * Java: language-specific code fragments in Java    * Properties: code in `.properties` files Use the Fold '{0}','{1}' ... placeholders to corresponding context expressions from Java/Kotlin code option to show folded substitutions for property key values. Note that using these settings might potentially slow down the `.properties` file loading.    * SQL: language-specific code fragments in SQL    * Scala: language-specific code fragments in [Scala](get-started-with-scala.html)    * XML: language-specific code fragments in XML    * YAML: code fragments in YAML files. Use the Limit folded keys and values to N characters option to configure the maximum number of characters to show in folded keys and values.    |

## How it works

*

* [Fold code elements](working-with-source-code.html#code_folding)

## See also

### Getting Started

[Editor basics](using-code-editor.html)

