Indentation Converter
Convert source code indentation between tabs and spaces (2, 4, or 8). Select your source indent style and target style - the converter handles the rest, preserving relative indentation levels.
FAQ
You select the source indent type manually (tabs or 2/4/8 spaces). The tool counts how many indent units each line has, then re-emits the same number of units using the target indent style.
The tool converts based on the source type you select. If your file has mixed tabs and spaces, choose the dominant style as the source. The converter rounds the indent level to the nearest match for the source width you specify.
The converter treats each line based on the source type you select. If you choose 'tabs' as source, leading tabs are counted; if you choose '4 spaces', it counts groups of 4 spaces. Mixed indentation in a single line can produce unexpected results — fix mixed indentation first using your editor's convert command.
The converter supports predefined sizes: tab, 2 spaces, 4 spaces, and 8 spaces. These cover the vast majority of coding conventions. For custom sizes not listed, you can use Find & Replace after conversion or process the file programmatically with a script.
The converter only changes leading whitespace (indentation). Any spaces or tabs within a line — like aligned comments, continuation indent, or tabular data — are not modified. This preserves formatting decisions made within code lines while fixing the overall indentation style of your file.
Yes. Only leading whitespace (indentation) is modified. Blank lines remain blank, and inline content like comments and code is never touched - only the indentation at the start of each line is converted.
More tools
HTML Formatter
Indent and beautify HTML with proper tag nesting and 2-space indentation.
XML Formatter
Beautify XML with proper indentation. Validate syntax automatically.
JSON Formatter
Pretty-print, validate, and minify JSON with syntax highlighting.
SQL Formatter
Format SQL with keyword capitalization and proper line breaks.
Whitespace Trimmer
Trim, collapse, and clean up whitespace in your text instantly.
Diff Checker
Compare two text blocks side-by-side and see exactly what changed.