⇥

Tab to Spaces

Convert tabs to spaces or back, width 2/4/8, collapsing leading indent with counts.
Tab 📂 Text 👤 ToolWorld 🏷️ v1.1.12
Loading...
⇄
Tab width
Original text
Result

How to Use

📖 Tool Introduction


Tab to Spaces is a small but sharp tool for resolving the eternal inconsistency between tab and space indentation in code and plain text. When you collaborate across machines, paste a snippet into a different editor, or copy code out of a PDF or a web page, you often end up in one of two frustrating situations: code that was indented with tabs on one machine shows up as ragged spaces on another, or a block laid out with spaces refuses to match a project style guide that demands tabs. This tool exposes both fixes as a single click. In tab-to-spaces mode every tab in the whole document is expanded into the number of spaces you choose, with widths of 2, 4 or 8 available to match a particular editor or language convention. In spaces-to-tab mode the tool is more conservative: it only collapses the leading indentation of each line, turning blocks of exactly width-multiple spaces back into tabs, while leaving spaces inside the line itself untouched so that alignment between columns is never damaged. After each run it tells you exactly how many tabs were expanded and how many space blocks were collapsed, so you always know what actually changed. The tool also detects whether the source uses CRLF or LF and keeps that ending in the output, which means a bulk conversion never silently rewrites the line endings of a source file. Everything runs locally in your browser, the original input stays untouched, and you can flip direction and width as many times as you like until the output finally matches your team standard, then copy it straight back into your editor or download it as a clean file. Because it handles full code blocks and long lists equally well, it is a convenient companion for reviewing pull requests, reformatting copied documentation, and normalizing snippets before they go into a shared codebase.

✨ Key Features


  • Bidirectional: tab to spaces and spaces to tabs, one click apart
  • Three widths: 2, 4 or 8 spaces per tab, matching mainstream conventions
  • Smart collapsing: spaces-to-tab only touches leading indentation, never in-line spacing
  • Conversion counts: reports expanded tabs and collapsed space blocks
  • Endings kept: preserves the original CRLF or LF line-ending style
  • Private by design: runs entirely in the browser with zero uploads

📝 How to Use


  1. Choose the direction at the top: tab to spaces or spaces to tabs
  2. Pick a tab width: 2, 4 or 8 spaces
  3. Paste the code or text to convert into the input area
  4. Click Convert and inspect the normalized indentation in the output
  5. Confirm the conversion counts, then copy or download the result

⚠️ Notes


  • Direction scope: tab-to-spaces expands every tab; spaces-to-tab only collapses leading indent
  • Remainders: leftover spaces shorter than one width are kept as spaces so alignment survives
  • Width choice: follow your project guide; mixing widths makes indentation look off
  • In-line spaces: word spacing inside a line is never altered, only the leading indent
  • Source safe: output never touches the input, so you can retry freely

Related

Translate
🌐
Online Translator
Translate between languages online with automatic source detection, one-click copy and local history
Word Count
📊
Word Counter
Word Counter is a completely free, instant-use online text statistics tool that helps writers, editors, translators and content operators quickly grasp key quantitative metrics of any text. Simply paste your text into the input box and click Count, and the tool instantly delivers a full set of statistics: total characters (both with and without spaces), Chinese character count, English word count, total lines, paragraph count, punctuation count, and an estimated reading time based on a common reading speed — so you can see the size of your text at a glance. Whether you are writing a WeChat article that must fit a word limit, preparing a speech that needs to match a time slot, or checking word counts for a translation, it provides accurate and reliable references. The tool also features a real-time counting mode in which results refresh automatically as you type, saving repeated clicks; the clear and one-click copy buttons make workflows even smoother. All counting happens locally in your browser — your text is never uploaded to any server, so your privacy is fully protected. The interface is clean and simple, available in Simplified Chinese, Traditional Chinese and English, automatically follows the website language, theme color and corner-radius style, and is fully responsive on desktop and mobile. No registration, no installation — just open and use. Word Counter is an essential everyday companion for editors, authors, students and social media operators.
Truncate
✂️
Text Truncator
Trim long text by characters, words or lines, with an ellipsis or custom ending.
Sort
↕️
Text Sorter
Text Sorter is a completely free, instant-use online text arrangement tool that sorts multi-line text by multiple rules in a flash. It is an efficient helper for list organization, data cleaning and file normalization. Simply paste the multi-line text you need to sort into the input box, then choose the sorting mode: ascending or descending, letter or numeric comparison, ignore case, sort by string length, or natural sorting (numbers inside the text are compared by numeric value) — the tool instantly outputs a clean, ordered result. It also supports detail options such as sorting after deduplication and keeping blank lines, satisfying precise needs across scenarios. Whether you are tidying a jumbled list of names and IDs, normalizing a shuffled keyword list, arranging file directories by name or length, or merging several lists and sorting them consistently with deduplication, it handles the job with ease. The sorted result can be copied or downloaded in one click for direct use in spreadsheets, documents or code files. All processing happens locally in your browser — your data is never uploaded to any server, so your privacy is protected. The interface is clean and simple, available in Simplified Chinese, Traditional Chinese and English, automatically follows the website language, theme color and corner-radius style, and works on both desktop and mobile. No registration, no installation — just open and use. Text Sorter is a common productivity tool for office workers, data analysts, programmers and students.
Simplify
㊯
Chinese Simplified-Traditional Converter
Bidirectional Simplified <-> Traditional Chinese converter with ~350 common characters.
Shuffle
🔀
Line Shuffler
Randomly shuffle the order of text lines, with reproducible seeds, keep-first and blank-line options.
Reverse
🔁
Text Reverser
Text Reverser is a completely free, instant-use online text transformation tool that rearranges any text in multiple directions with a single click. It is a handy companion for coding practice, creative writing, fun sharing and everyday text processing. The tool offers four reversal modes: character reversal, which flips the order of every character in the text; word reversal, which keeps the letters inside each word intact and reverses only the word order; per-line reversal, which applies character reversal independently to every line of multi-line text; and whole-block reversal, which turns the line order of a multi-line block upside down. You can switch between modes freely, preview the output in real time, and copy or download the result with one click. Whether you are constructing reversal test cases while debugging an algorithm, creating palindrome-style or acrostic playful copy, or reordering items while organizing meeting notes, this tool handles it quickly. All processing happens locally in your browser — your text is never uploaded to any server, so your privacy is protected. The interface is clean and simple, available in Simplified Chinese, Traditional Chinese and English, automatically follows the website language, theme color and corner-radius style, and works on both desktop and mobile. No registration, no installation — just open and use. Text Reverser is a practical utility for programmers, copy editors and students.
Newline
↵
Line Ending Converter
Detect and normalize CRLF/LF/CR line endings with live counts and three targets.
⏫︎