The formatting shortcuts in Intellij IDEA are :

  • For Windows : Ctrl + Alt + L
  • For Ubuntu : Ctrl + Alt + Windows + L
  • For Mac : ⌥ (Option) + ⌘ (Command) + L
Answer from axelrod on Stack Overflow
🌐
JetBrains
jetbrains.com › guide › java › tutorials › reading-code › formatting
Formatting - JetBrains Guide
March 1, 2024 - If we encounter code that is not properly formatted, we can have IntelliJ IDEA reformat the code for us. In the file you want to reformat, use the shortcut ⌘⌥L (macOS) / Ctrl+Alt+L (Windows/Linux).
Discussions

"Reformat Code" can not be called via the shortcut "⌘⌥L"
Review its shortcut in settings. More on reddit.com
🌐 r/Jetbrains
5
6
November 21, 2024
Intellij finally has a built in "Reformat code and organize imports" save action in 2021.2

It automatically saves, so usually I just use the reformat code shortcut (rather than using save and have auto format in other IDEs)

More on reddit.com
🌐 r/IntelliJIDEA
4
16
July 28, 2021
[Q] Why, or why don't you, prefer IntelliJ over Eclipse?
I switched from eclipse to intellij 7 years ago. I switched back 2 months ago (because jobs both times). Eclipse handles multi-project workspaces better, though it's not true that intellij can't, you just have to know how to pull in the other projects as peers. Eclipse doesn't seem to lose track of things the way intellij does. In intellij, when I change a maven pom file, it can just get stuck never properly updating itself. It can easily forget little details like the fact that the current project is using preview features. You can get into situations where you simply have to blow away your .m2 directory and start over. I think this mostly comes down to intellij's caching and indexing and it can go awry. Eclipse has incremental compilation and you can see your errors in your whole project at a glance. The fact that you cannot do this in intellij is the biggest broken thing about intellij. Sure, you can tell intellij to use eclipse's compiler, but in the UI it simply doesn't work as well. Debugging in both is different, and at first, you'll hate how the other works if you switch. However, I think they are roughly equivalent. Where intellij shines and eclipse falls short is in the plugin market and in actual editing of java code. Eclipse's plugin market is a ghost town. Utterly disastrous and sad. When editing, intellij is just better at helping you generate java code. Everything about it is better. This is a big enough deal that I would choose to give up the better incremental compilation and view of project-wide errors for thediting experience of intellij. More on reddit.com
🌐 r/java
229
65
February 21, 2024
Quick text replace
There is already such a shortcut: `sout` You can create your own (as mentioned by u/joranstark018 ), but you don't even need to go that far for System.out.println. Another common one is `psvm` which gets converted to `public static void main(String[] args) {}` More on reddit.com
🌐 r/IntelliJIDEA
7
7
September 15, 2022
🌐
JetBrains
jetbrains.com › help › idea › reformat-and-rearrange-code.html
Reformat code | IntelliJ IDEA Documentation
4 weeks ago - Reformat your code (Ctrl+Alt+L). IntelliJ IDEA will reformat your code in accordance with the current style settings, keeping existing formatting for the rules which you've selected.
🌐
Medium
medium.com › nerd-for-tech › auto-format-code-in-android-studio-intellij-idea-1f0450ee44a3
Auto format code in Android Studio/Intellij IDEA
June 10, 2021 - Click Remove to remove the ⌘S shortcut for the File | Save All action. You can always reassign it later if necessary. Click OK to apply the changes. Now, when you press ⌘S, Android Studio/IntelliJ IDEA will invoke the new macro: reformat the current file and save your project.
🌐
JetBrains
jetbrains.com › guide › java › tutorials › reformatting-code › reformatting-a-selection-or-class
Reformatting a selection of code or class - JetBrains Guide
February 17, 2023 - You can use ⌘⌥L (macOS) / Ctrl+Alt+L (Windows/Linux) to reformat a selection of code according to your reformat settings. Let's press ⌘⌥L (macOS) / Ctrl+Alt+L (Windows/Linux) in the class that contains this horribly formatted code:
🌐
JetBrains
jetbrains.com › guide › tips › reformat-code-or-file
Reformat Your Code - JetBrains Guide
June 12, 2024 - Lastly, there are additional settings you can use for reformatting your code which you can access by invoking the "Reformat Code Dialog" ⌘⌥⇧L (macOS) / Ctrl+Alt+Shift+L (Windows/Linux). The options here will vary depending on which type of code you're working with so try it out and see what you can learn! Want to learn more? Check out the in depth reformatting tutorial for IntelliJ IDEA ·
🌐
IQCode
iqcode.com › code › other › reformat-intellij
reformat intellij Code Example
October 18, 2021 - // Mac CMD + Option + L // Windows Ctrl + Alt + L
Find elsewhere
🌐
Reddit
reddit.com › r/jetbrains › "reformat code" can not be called via the shortcut "⌘⌥l"
r/Jetbrains on Reddit: "Reformat Code" can not be called via the shortcut "⌘⌥L"
November 21, 2024 -

If I open IntelliJ IDEA 2024.3 (Ultimate Edition) on macOS ⌘⌥L to reformat code works at first. After a while it stops working. After it stops working I still can reformat code via the Menubar.

Any thoughts?

🌐
JetBrains
blog.jetbrains.com › home › intellij idea › how to format java code
How to Format Java Code - The JetBrains Blog
June 6, 2024 - While coding with IntelliJ IDEA, we don’t need to manually format our code, as the IDE does it automatically. For example, if we press Enter (Windows/Linux) or ⏎ (macOS), the caret goes into the correct place for us to start typing. The same is true if we use other shortcuts like Shift+Enter ...
🌐
JetBrains
jetbrains.com › help › idea › reformat-file-dialog.html
You will be redirected shortly
August 9, 2022 - You will be redirected shortly · Redirecting… · Click here if you are not redirected
🌐
YouTube
youtube.com › shorts › DX5C19cmX9o
IntelliJ IDEA coding tips - reformat - YouTube
#intellijidea #intellij #java #jetbrains #programming #shorts
Published: November 24, 2023
🌐
Websparrow
websparrow.org › home › intellij idea – code reformat and rearrange shortcut keys
IntelliJ IDEA – Code reformat and rearrange shortcut keys - Websparrow
July 24, 2020 - In IntelliJ IDEA, we can use Ctrl + Alt + L to reformat and rearrange code in Windows and Linux machine and for Mac OS, use command + option + L.
🌐
JetBrains
jetbrains.com › guide › java › tutorials › reformatting-code › reformatting-only-code-youve-changed
Reformatting code you've changed - JetBrains Guide
February 17, 2023 - As we talked about in the previous step, you can use the keyboard shortcut ⌘⌥L (macOS) / Ctrl+Alt+L (Windows/Linux) to reformat a selection of code or the whole class according to your reformatting settings.
🌐
Medium
hirosht.medium.com › automatically-reformat-code-on-save-in-intellij-ddf7842801e0
Automatically reformat code on save in IntelliJ - Hirosh Tharaka - Medium
July 12, 2023 - Automatically reformat code on save in IntelliJ Configure the IDE to reformat code in modified files automatically when your changes are saved. Press Ctrl+Alt+S to open the IDE settings select Tools …
🌐
Reddit
reddit.com › r/intellijidea › intellij finally has a built in "reformat code and organize imports" save action in 2021.2
r/IntelliJIDEA on Reddit: Intellij finally has a built in "Reformat code and organize imports" save action in 2021.2
July 28, 2021 -

Intellij finally implemented a feature that other IDEs had for years. You can now finally set up Intellij to automatically reformat your code and organize your imports on each save. There is no more need to either download the "Save Actions plugin" or to write your own macro to execute these two commands on each save. It was about effin' time.

🌐
JetBrains
jetbrains.com › guide › java › tutorials › reformatting-code › reformatting-code-settings
Reformatting Code Settings - JetBrains Guide
February 17, 2023 - You can view the settings for code formatting with ⌘, (macOS) / Ctrl+Alt+S (Windows/Linux) to display the Preferences/Settings dialog. This dialog is searchable so the fastest way to find the settings is by typing in code style.
🌐
JetBrains
intellij-support.jetbrains.com › hc › en-us › community › posts › 360008191759-Reformat-Code-Shortcut-Option-Command-L-Conflicts-in-Mac
Reformat Code Shortcut (Option-Command-L) Conflicts in Mac – IDEs Support (IntelliJ Platform) | JetBrains
Apparently it's conflicting with a Mac shortcut so that pressing Option-Command-L is bringing another application window to the front rather than running reformat. I could not find any conflicting keybinding in Keyboard preferences. Current IntelliJ Idea version is 2020.1 in Mac 10.15.4, however, I'm having this issue for a long time, it's not new to this version.
🌐
Inspeerity
inspeerity.com › home › blog › know your ide: intellij idea. 7 keyboard shortcuts you didn’t know about (part 1)
Intellij IDEA keyboard shortcuts you didn't know about ★ Blog Inspeerity
May 13, 2024 - Instead of creating manually test classes you can use the shortcut Ctrl+Shift+T. Formatting and cleaning. If you have a problem with organisation of the code you can use Ctrl+Alt+L to format the code. If you want to organize the imports use Ctrl+Alt+O, to execute all the formatting features just use Ctrl+Shift+Alt+T. Also read: Know your IDE: IntelliJ IDEA (part 2) – Navigate Through the Project With Use of Keyboard.
🌐
Medium
medium.com › @AlexanderObregon › intellij-ideas-code-style-features-creating-consistent-and-clean-code-bd1c32df8285
IntelliJ IDEA: Clean & Consistent Code | Medium
April 29, 2024 - Proper indentation, spacing, and alignment make the code easier to read. IntelliJ IDEA provides strong support for code formatting. Use Ctrl + Alt + L (Windows/Linux) or Cmd + Option + L (Mac) to reformat the current file or selected code.
🌐
Marit van Dijk
maritvandijk.com › home › for the record: how to format records in intellij idea
For the record: How to format records in IntelliJ IDEA - Marit van Dijk
May 19, 2025 - IntelliJ IDEA can format your code for you. Code will be formatted as you type it, and if needed you can Reformat the code (⌘⌥L on macOS) / Ctrl+Alt+L on Windows/Linux).