I’m comparing AI coding assistants and ran into a weird formatting issue: some seem to default to tabs, while others use spaces. I know the tabs vs spaces debate is kind of pointless, but I need consistent code style across projects and teams. I’m trying to find out which AI tools default to which indentation style so I can avoid messy diffs and extra cleanup.
Most AI coding assistants do not have a fixed indent religion. They follow context.
What I see in practice:
-
ChatGPT, Claude, Gemini, Copilot.
They usually mirror your file.
If your snippet uses 4 spaces, they keep 4 spaces.
If your file uses tabs, they often keep tabs.
If you give no context, many drift toward spaces. Usually 4 for Python, 2 or 4 for JS, TS, JSON, etc. -
Cursor, Windsurf, Cody, Continue.
Same story. The model output matters less than editor rules.
Your workspace settings, .editorconfig, prettier, eslint, biome, gofmt, rustfmt, black, all of these drive the result more than the AI does.
Practical fix:
- Add .editorconfig
Example:
root = true
[*]
indent_style = space
indent_size = 4
[Makefile]
indent_style = tab
-
Set formatter rules.
Prettier: useTabs false
ESLint: indent rule, if you still use it
Biome: indentStyle space -
Turn on format on save.
-
Put one line in your AI prompt.
‘Match existing project formatting. Use spaces, 4-space indent.’ -
Keep a sample file open. A lot of tools copy local context beter than global rules.
If you want consistency, trust formatter config, not model vibes. AI defaults are fuzzy. Your toolchain should be strict.
Short version: if there’s no project context, most AIs lean spaces. Tabs are kinda the exception, not the default.
Where I’d slightly disagree with @byteguru is this: “they just mirror context” is mostly true in-editor, but not as true in plain chat. In chat windows, a lot of models normalize formatting on output, and that usually means spaces sneaking in even if you pasted tabbed code. So if you’re comparing assistants side by side, the UI matters almost as much as the model.
My rough take:
- Chat-style assistants: spaces by default most of the time
- IDE assistants: whatever your file/editor already does
- Language-specific generators: often spaces unless the formatter says otherwise
- Old-school tab behavior: more common in Go/C projects with existing tabbed files
Also, some tools “look” like tabs but are soft tabs, which confuses the heck outta people during copy/paste tests.
If you actually want to compare them, do a dumb controlled test:
- Empty file, no config
- Ask for nested code in Python, JS, and Go
- Check raw indentation chars, not visual indent
- Repeat inside the editor plugin and in browser chat
You’ll probly find that “AI default” is less a model trait and more an environment trait. Annoying, but true.
I mostly agree with @byteguru, but I’d push one point harder: “default indentation” is often fake. A lot of assistants are not deciding tabs vs spaces in any meaningful sense. They’re producing formatted text through markdown renderers, editor adapters, or post-processing layers that silently convert indentation.
So if you’re asking which AI defaults to what, the practical answer is:
- Raw chat outputs usually end up as spaces
- IDE-integrated assistants usually inherit editor settings
- Formatter-first stacks make the whole question irrelevant after save
The annoying part is that people blame the model when the real culprit is often one of these:
- Markdown code block normalization
- Soft-tab editor settings
- Prettier, Black, gofmt, rustfmt
- Copy/paste into a different editor
- Web UIs that collapse or sanitize whitespace
Where I slightly disagree with @byteguru is on Go/C being “old-school tab behavior.” Go is less about tradition and more about enforced tooling. If gofmt touches it, your AI preference doesn’t matter much.
If consistency is the goal, stop treating the assistant as the source of truth. Make your formatter the source of truth. EditorConfig plus language formatter beats trying to train every assistant into behaving.
Pros for ':
- Can improve readability if it standardizes pasted AI output
- Useful if your team compares assistant output often
Cons for ':
- Another layer that may hide the real indentation chars
- Can make debugging whitespace issues harder if it auto-converts silently
My take: the winning setup is not “find the AI that loves tabs” or “find the AI that loves spaces.” It’s “use the AI that respects repo config and then let tooling enforce style.”