Sometimes, the source code needs to replace tabs with spaces in Eclipse. Eclipse uses tabs for spaces by default.
Tabs are always dependent on the environment and use 4 spaces in windows.
If you use source code written with tab spaces, the code is consistent across different environments.
It is always recommended to use spaces for consistency.
These tutorials show how to convert tabs into spaces in Eclipse.
How to convert tabs to spaces in Eclipse
Following are steps by steps to convert tabs to spaces.
We have different editors in Eclipse Java, default and HTML editors, etc.
- Open Eclipse 
- Select the - WindowsMenu >- Preferences, It opens the Preferences popup window.
- if you want to change the Java editor, select Java, if it is following languages, The following are options - java editor - Select the - Javatab and- Code Style- XML editor - Select the- XMLtab and- Code Style- HTML editor - Select the- Webtab and select- HTML Files- C++/C editor - Select the- C/C++tab and- Code Style- Below are steps for a Java editor 
- Go to the - Javatab Select- Code Styleand select the- Formatteroption
- Click on the - Editbutton
- It opens the profile settings window 
- Select the Indentation tab 
- Change the - tab policyfrom- Tabs Onlyto- Spaces Only
- Click on the - okbutton to save the changes.
- Click on the - Apply and Closebutton on the preferences window to close
Please see the screenshot.

Steps for Eclipse default editor
- Open Windows>Preferences, Opens Preferences window
- Select General>Editors>Text Editors
- Check Insert Spaces for Tabs
- Click on the Apply and Closebutton on the preferences window to close
How to replace tab spaces in Eclipse Editor for a single file
Sometimes, You want to replace a tab with spaces or commas or a new line in a single file.
Here are steps
- Open Eclipse and open the source code file in the code editor 
- Go to the - Find/ReplaceMenu or use- Ctrl+- F
- It shows a popup dialog with - Findand- Replace withtext boxes
- Check - Regular Expressions
- to convert tabs to spaces Provide the below values and Click the - Replaceor- Replace Allbutton Find:
\t
Replace with
space
- to convert tab to comma
Provide the below values and Click the ReplaceorReplace Allbutton Find what:
\t
Replace with
,
- to convert tab to comma Find what:
\t
Replace with
\r\n
Here are characters that you can use to replace tab character
\b is a backspace character
\n\r is a new line with a returning end
\t is the tab character