How to auto-format code in Eclipse? September 17, 2022 by Tarik On Windows and Linux : Ctrl + Shift + F On Mac : ⌘ + ⇧ + F (Alternatively you can press Format in Main Menu > Source)