Cette page n’est pas encore traduite en français : elle s’affiche en anglais.

Convert Tabs to Spaces

Replace every tab with spaces — 2 by default; change it to 4 if your project uses that — to fix mixed indentation before you commit or paste code.

Mis à jour le
Result

Vos données ne quittent jamais votre ordinateur. Tout le traitement se fait localement dans votre navigateur.

Comment utiliser : Tabs to Spaces

  1. Paste your code — tabs are replaced with two spaces.
  2. For four spaces, type four spaces in Replace.
  3. Copy the result.

Spaces back to tabs

Set Find to ^( {4})+… or more simply to four spaces with Regex off, and Replace to . To make the change consistent across a project, add an .editorconfig — generate one with the EditorConfig Generator.

Aussi recherché comme : convert tabs to spaces, tab to space converter, spaces to tabs, replace tabs with spaces, fix indentation.

Outils complémentaires : Tabs to Spaces

  • Find and Replace — Paste text and replace words or patterns — case-sensitive or not, whole words only, or with regular expressions and $1 capture groups.
  • Line Ending Converter — See which line endings a file uses and convert them — Windows CRLF to Unix LF or back — for pasted text or a whole batch of files, with trailing-space and tab cleanup on the side.
  • JavaScript Formatter — Unminify and pretty-print JavaScript, JSON or JSX with your preferred indentation and brace style — or strip whitespace and comments with a verified minifier.
  • Remove Extra Spaces — Collapse double spaces, runs of spaces and stray tabs into a single space — line breaks are kept.

Questions fréquentes

How many spaces is a tab?
There’s no fixed rule: 2 is common in JavaScript and web projects, 4 in Python and Java.
Does it only change indentation?
It replaces every tab. To change only leading tabs, use the pattern ^ + and adjust the replacement.
Is my code uploaded?
No. It runs in your browser.
Puis-je installer Tabs to Spaces en tant qu’application web et l’utiliser hors ligne ?
Oui. Tabs to Spaces est une application web installable (PWA) : elle s’installe depuis votre navigateur, sans passer par une boutique d’applications. Cliquez sur « Installer l’application » en haut de cette page dans Chrome ou Edge (Windows, macOS, Linux, ChromeOS) ; sur Android, utilisez « Partager » → « Ajouter à l’écran d’accueil » sur iPhone et iPad ; ou « Fichier » → « Ajouter au Dock » dans Safari 17+ sur Mac. L’application s’ouvre alors dans sa propre fenêtre avec sa propre icône, et comme elle s’exécute entièrement dans votre navigateur, elle continue de fonctionner hors ligne. Firefox sur ordinateur de bureau ne permet pas d’installer d’applications web. Comment fonctionne l’installation.

Outils similaires