Eclipse code editor, By default text intended with tab characters.
We can change this tab behavior in eclipse in multiple ways.
Some programmers use other text editors like Intelli IDEA, VSCode.
Each IDE has tab settings configured default.
You will get indentation style issues when you are importing non-eclipse projects. This post solves how to replace tabs with spaces in the code editor of the eclipse.
As tabs are applied to the code editor. So based on your language, you can replace tab with spaces.
In this tutorial, You will use Java code editor. How do you replace tabs with spaces in java eclipse?
- Go to Windows Menu
- Select Preferences Option, Popup window opened
- Select java on left side options
- Check Code style
- Select the Formatter option as seen in the below screenshot

- Create a new setting as seen below

- It opens a new popup window and changes the settings as seen below

- Finally, apply and close the popup window
Here is the formatted code
package testing;
public class Test {
public static void main(String[] args) {
System.out.println("Welcome ");
}
}
if code does not indent as per space settings, select code in a code editor, right-click, context menu opened, Select source -> Correct Indentation or CTRL+L short cut to format the java
You can also do the same settings in PHP, javascript editors.