How to format files and folders

Last modified: June 23, 2025

dbForge Studio for MySQL provides the SQL Formatter that enables you to format SQL code efficiently. It also supports bulk formatting that allows you to format multiple selected files or entire folders at once.

Format files

1. Open the SQL Formatter by navigating to the Tools menu and selecting SQL Formatter.

2. On the Formatting mode page of the wizard, the Files mode is selected by default. To proceed, select Next.

Formatting mode: Files

3. On the File list page, select Add to add the files you want to format.

  • In the Open window, select the file and then select Open.
  • When the Keep modified files open after formatting checkbox is selected (default option), dbForge Studio opens the formatted files after completing the formatting process. Otherwise, clear the checkbox.

Tip

To remove the selected file from the list, select Remove.

Files formatting mode - Files list

4. To start formatting the file, select Format.

5. In the Connect to Server window that opens, select the connection and then select Connect.

6. In the pop-up window informing that the number of files has been formatted, select OK to close it.

Note

To format a specific document instead of an entire file or directory, use the shortcut menu or a keyboard shortcut. You can also change predefined formatting styles from the shortcut menu to find the one that best suits your needs. If the selected profile does not meet your requirements, use the formatting profile settings to adjust options such as indents or line breaks.

For instructions on customizing formatting profile settings, see Configure formatting profile settings.

Format folders

1. Open the SQL Formatter by navigating to the Tools menu and selecting SQL Formatter.

2. On the Formatting mode page of the wizard, select the Directories mode and then select Next.

Formatting mode: Directories

3. On the Folder list page, select Add to add the folder with the files you want to format:

  • In the Browse For Folder window, select the folder with the file you want to format and then select OK.
  • In the Look at these file types: box, select *.sql to format only SQL files or *.* to apply SQL formatting to all files, regardless of their name or extension.
  • When the Keep modified files open after formatting checkbox is selected (default option), dbForge Studio opens the formatted files after completing the formatting process. Otherwise, clear the checkbox.
  • When the Include sub-folders checkbox is selected (default option), all subfolders within the main folder are automatically included in the operation.

Tip

To remove the selected folder from the list, select Remove.

Directories formatting mode - Folder list

4. To start formatting the folder, select Format.

5. In the Connect to Server window that opens, select the connection and then select Connect.

6. In the pop-up window informing that the number of files has been formatted, select OK to close it.

Note

Each formatted file opens in a new SQL document.

Save the formatted file

To save the formatted file, on the SQL toolbar, select Save As and save the file to the desired folder.