An indent and outdent tool adds or removes leading whitespace from every line in your text. Whether you are fixing indentation in copied code, adjusting nested list hierarchy, or normalizing formatting across a document, this free online code indenter adjusts levels in one click. No signup required. Try it now for instant results.
✨ Try the Free Online Indent/Outdent
How to Use Indent/Outdent — Step by Step
Step 1: Set your indent width
Choose how many spaces to add or remove (1-16), or toggle the checkbox to use tabs instead of spaces. The default is 4 spaces, which matches most modern coding standards.
Step 2: Paste your text
Type or paste your code, list, or any multi-line text into the input area. The tool works with any text format — Python, JavaScript, YAML, Markdown, plain text outlines, or configuration files.
Step 3: Click Indent or Outdent
Click "Indent →" to add the configured whitespace to the start of every line. Click "← Outdent" to remove up to that amount of leading whitespace from each line. The tool preserves relative indentation between lines.
Step 4: Review and copy
The output appears instantly. If the result needs adjustment, change the indent width or switch between spaces/tabs and click again. Copy the result with one click for use in your editor or document.
Real-World Examples
Code Formatting: A developer pastes code from a tutorial that uses 2-space indentation into a project requiring 4 spaces. Indent adjusts every line instantly.
Nested Lists: A writer pastes a flat outline and indents sub-points by 4 spaces to create visual hierarchy in a plain-text document.
YAML Fix: A DevOps engineer outdents a misaligned YAML block by 2 spaces to fix a configuration parsing error.
Markdown Code Blocks: You copy code from a GitHub issue that has no indentation. Before pasting into your Markdown file (which requires 4-space indentation for code blocks), you indent the entire block at once.
Config File Standardization: Your team uses 2-space indentation but a new contributor's PR uses tabs. You outdent their file (removing tabs) then re-indent with 2 spaces for consistency.
Legal Document Outline: A paralegal receives a flat list of contract clauses. They indent sub-clauses by 4 spaces to create a proper hierarchical outline for attorney review.
Features
- Configurable indent level from 1 to 16 spaces
- Tab mode: use tab characters instead of spaces for indentation
- Indent adds leading whitespace to every line
- Outdent removes up to the configured amount of leading whitespace
- Preserves relative indentation between lines
- Instant results with one-click copy to clipboard
- Works with any text format: code, lists, outlines, config files, Markdown
- Handles empty lines gracefully (skips them during processing)
Tips & Best Practices
- Match your project's style guide: Most modern JS/Python projects use 2 or 4 spaces. Go uses tabs. Match the target environment.
- Use tabs for Makefiles and Go: Makefiles require literal tabs. Go's
gofmtenforces tabs. Use the tab checkbox for these formats. - Preserve relative hierarchy: The tool adds/removes the same amount to every line, preserving the relative indentation structure. This is critical for Python and YAML.
- Fix YAML indentation errors: YAML is whitespace-sensitive. A 1-space misalignment breaks parsing. Use outdent to remove inconsistent indentation, then re-indent correctly.
- Combine with Tabs to Spaces: Use Tabs to Spaces first if you have mixed tabs/spaces, then use Indent/Outdent for uniform formatting.
- Test in your editor: After indenting, paste into your IDE to verify syntax highlighting and linting pass.
- Normalize before committing: Run team code through Indent/Outdent to enforce consistent indentation before PR review.
- Use for Markdown code blocks: Markdown requires 4-space indentation for fenced code blocks. Paste raw code, indent by 4 spaces, and paste into your .md file.
- Fix copied Stack Overflow code: Code from SO often has inconsistent indentation. Outdent to zero, then re-indent to your standard.
Common Use Cases
Developers
Fix indentation when copying code between editors, normalize indentation across team contributions, or adjust YAML/JSON nesting levels.
Technical Writers
Create properly indented documentation, adjust code block formatting in manuals, and maintain consistent text hierarchy.
Content Editors
Indent bullet points, adjust nested list levels, and normalize formatting across documents from multiple contributors.
DevOps Engineers
Fix YAML/JSON configuration files, standardize Docker Compose indentation, and normalize Kubernetes manifest formatting.
Data Scientists
Adjust notebook code cell indentation when exporting to scripts, format SQL query indentation for readability.
Python Developers
Fix indentation errors when refactoring code blocks, adjust nested function/class indentation, standardize 4-space convention.
Legal & Technical Documentation
Create hierarchical outlines with proper indentation for contracts, specifications, and regulatory documents.
Frequently Asked Questions
Q: What is the difference between indent and outdent?
A: Indent adds whitespace to the beginning of every line. Outdent removes whitespace from the beginning of every line, up to the configured amount.
Q: Can I use tabs instead of spaces?
A: Yes. Check the 'Use tabs instead' checkbox, and the tool will use tab characters for indentation instead of spaces.
Q: Does it preserve relative indentation?
A: Yes. If line B is indented more than line A, both lines receive the same additional indentation, preserving their relative hierarchy.
Q: What happens if a line has less indentation than the outdent amount?
A: Outdent removes all available leading whitespace up to the configured amount. If a line has fewer spaces, all of them are removed.
Q: Can I use this for YAML indentation fixes?
A: Yes. YAML is whitespace-sensitive. Use indent/outdent to adjust nesting levels and fix configuration parsing errors.
Q: Is my code sent to a server?
A: No. All processing happens locally in your browser. Your code and text are never transmitted to any external server.
Q: What's the maximum indent level?
A: 16 spaces (or tabs). This covers all common indentation standards from 1-space minimalist to 16-space extreme nesting.
Q: Can I indent only specific lines?
A: The tool processes all lines. For selective indentation, copy specific lines, indent them, then paste back into your document.
Q: Does it handle mixed tabs and spaces?
A: The tool treats tabs and spaces separately. If your file has mixed indentation, use Tabs to Spaces first to normalize, then use Indent/Outdent.
Q: Can I use this for Python code?
A: Yes. Python uses indentation for block structure. The tool preserves relative indentation, making it safe for Python code. Just ensure you use spaces (not tabs) for Python.