Outdent Lines

Remove indentation from text lines with intelligent handling of tabs and spaces. Remove multiple indent levels at once with customizable spacing settings. Perfect for reducing code nesting and flattening text hierarchy.

12345
12345678
Will remove: 1 tab or 2 spaces (per level)

You might also like

View All 136 Tools

About Outdent Lines

An outdent lines tool (also called dedent or unindent) is a free online text formatter that removes indentation from the beginning of each line in your text. This essential utility intelligently handles both tabs and spaces, making it perfect for reducing code nesting levels, flattening hierarchical content, or fixing over-indented text.

Our tool processes text directly in your browser, ensuring complete privacy while offering flexible outdenting options. Configure the number of indent levels to remove (1-5) and specify how many spaces constitute one indent level (1-8) for precise control.

How to Use the Outdent Lines Tool

  1. Paste or type your text into the input box (or upload a text file)
  2. Set indent levels to remove - Choose 1-5 levels using the slider
  3. Configure spaces per level - Set 1-8 spaces per indent level (slider)
  4. Review the preview - See what will be removed
  5. Click “Outdent Lines” - Process your text instantly
  6. Copy or download your outdented text using the buttons below

The tool works offline after the first load and processes everything in your browser!

What is Outdenting?

Outdenting (or dedenting/unindenting) is the opposite of indenting—it removes whitespace from the beginning of lines. This is useful when you need to reduce nesting levels in code, flatten hierarchical text structures, or correct over-indented content.

How Outdenting Works

Priority Order: The tool first tries to remove tabs (\t), then spaces. This handles mixed indentation gracefully.

Configurable Levels: Set how many indent levels to remove (1-5). Each level removes one tab or the specified number of spaces.

Space Detection: Configure how many spaces equal one indent level (1-8). Common settings: 2 spaces (JavaScript), 4 spaces (Python).

Smart Processing: Empty lines are preserved. Lines with insufficient indentation are handled gracefully—partial indentation is removed without errors.

Preview Display: Before processing, see exactly what will be removed per level (e.g., “1 tab or 2 spaces, then 2 spaces”).

Key Features

Smart Removal - Prioritizes tabs, then spaces
Multiple Levels - Remove 1-5 indent levels at once
Configurable Spacing - Set 1-8 spaces per indent level
Mixed Indentation - Handles tabs and spaces together
Preview Display - See what will be removed before processing
Empty Line Preservation - Blank lines stay blank
Monospace Display - Font ensures proper indentation preview
File Upload Support - Process .txt, .md, code files
Copy to Clipboard - Copy outdented text instantly
Download Option - Save as “outdented-text.txt”
Visual Feedback - Green when processed, red on error
100% Private - All processing happens in your browser
Works Offline - Functions without internet after initial load

Use Cases by Industry

Developers & Programmers

Reduce code nesting levels, flatten over-nested functions, refactor indented code blocks, and fix accidentally over-indented code.

Technical Writers

Adjust documentation indentation, flatten nested lists, reformat code examples, and prepare content for different formats.

Content Creators

Remove hierarchical structure from text, flatten nested outlines, adjust list indentation, and prepare content for publishing.

Data Analysts

Format data files, adjust CSV indentation, clean formatted output, and prepare structured data for processing.

Students & Academics

Fix over-indented assignments, adjust code formatting, flatten nested notes, and prepare submissions.

System Administrators

Adjust configuration file indentation, clean log output, reformat scripts, and fix indentation in text files.

Common Use Cases

Reducing Code Nesting

Before:
        if (condition) {
            doSomething();
        }

After (remove 2 levels, 4 spaces):
if (condition) {
    doSomething();
}

Perfect for: Refactoring deeply nested code

Flattening Lists

Before:
    • Main Item
    • Main Item
    • Main Item

After (remove 1 level, 4 spaces):
• Main Item
• Main Item
• Main Item

Perfect for: Converting nested lists to flat lists

Fixing Over-Indentation

Before:
        Line 1
        Line 2
        Line 3

After (remove 2 levels, 4 spaces):
Line 1
Line 2
Line 3

Perfect for: Correcting accidentally over-indented text

Mixed Tab/Space Handling

Before: (tab followed by 4 spaces)
	    indented line

After (remove 1 level detecting 4 spaces):
    indented line
(or)
After (remove 2 levels):
indented line

Perfect for: Cleaning up mixed indentation styles

Understanding Outdenting Options

Indent Levels to Remove (1-5)

  • Level 1: Removes one tab or one set of spaces
  • Level 2: Removes two tabs or two sets of spaces
  • Level 3-5: For deeply nested content

Spaces Per Indent Level (1-8)

Configure what the tool considers “one indent level” when dealing with spaces:

  • 2 spaces: JavaScript, TypeScript, JSON standard
  • 3 spaces: Less common, some style guides
  • 4 spaces: Python, Java, C# standard
  • 8 spaces: Traditional tab width, rarely used

Priority: Tabs First

The tool always tries to remove tabs before spaces. This handles mixed indentation files where some lines use tabs and others use spaces.

Preview Display

Before processing, you see: “Will remove: 1 tab or 4 spaces, then 4 spaces (per level)” - this tells you exactly what will be removed from each line that has indentation.

How the Algorithm Works

For Each Line:

  1. Skip empty lines (preserve them)
  2. For each level to remove:
    • First, try to remove one tab
    • If no tab, try to remove N spaces (N = spaces per level)
    • If not enough spaces, remove any leading space/tab
    • If no indentation left, stop

This ensures graceful handling of:

  • Mixed tab/space indentation
  • Inconsistent indentation levels
  • Lines with less indentation than requested

Pro Tips

For Code Refactoring:

  • Use 2 spaces for JavaScript/TypeScript
  • Use 4 spaces for Python/Java/C#
  • Match your project’s indentation standard
  • Review output before saving

For Document Formatting:

  • Start with 1 level, increase if needed
  • Check the preview before processing
  • Preserve blank lines for readability
  • Combine with other formatting tools

For Mixed Indentation:

  • The tool handles tabs and spaces automatically
  • Tabs are removed first (standard behavior)
  • Configure spaces per level to match your file
  • Test with small samples first

For Best Results:

  • Know your file’s indentation style
  • Use preview to verify settings
  • Process incrementally if unsure
  • Save original before processing large files

Frequently Asked Questions

How does the tool decide what to remove?

For each level to remove, the tool first tries to remove a tab. If there’s no tab, it removes the configured number of spaces. If there aren’t enough spaces, it removes whatever leading whitespace exists.

Can it handle mixed tabs and spaces?

Yes! The tool prioritizes removing tabs first, then spaces. This handles files where some lines use tabs and others use spaces.

What if a line has less indentation than requested?

The tool removes as much indentation as possible without errors. If you request 3 levels but a line only has 1 level, it removes that 1 level and stops.

Does it work offline?

Yes! All processing happens locally in your browser. After the initial page load, you can outdent lines completely offline. Your text never leaves your device.

Is my text data private?

Absolutely. All processing happens in your browser (client-side). Your text never leaves your device, and we never log, track, or collect any data. Works completely offline.

Why configure spaces per level?

Different projects use different indentation standards. JavaScript often uses 2 spaces, Python uses 4 spaces. Configure this to match your file for accurate outdenting.

What happens to empty lines?

Empty lines are preserved without any changes. The tool only processes lines that contain text.

How is this different from trim?

Trim removes whitespace from both ends of text. Outdent specifically removes indentation (leading whitespace) from each line, level by level.

Can I process code files?

Yes! Upload any text-based file (.txt, .py, .js, .java, .md, etc.). The tool works with all text formats.

Can I use this for commercial projects?

Yes - completely free for any use: personal writing, commercial content, client work, educational institutions, software development. No attribution required. Unlimited use forever.

From the same team