How to remove indentation from text online
Copyable sample text
Indent size option
Remove all option
Copy the result or download it as a .txt file
Features explained
Unindent text online
Removes indentation from the start of the lines in your text.
Indent size option
Sets how much indentation is removed from each line. The default is 2.
Remove all option
Off by default. When on, it clears all the indentation instead of removing a set amount.
Copy result to clipboard
One click copies the result. The button changes to Copied! so you know it worked.
Download as .txt
Saves the result as a plain text file, useful when you want to keep it.
Load example
Fills the input with sample text so you can see how the options work before you use your own.
Clear and reset
The Clear button empties the tool so you can start with new text.
Runs in the page
Text is processed with JavaScript in the page. No request to a server was found in the tool code.
What can you use it for?
Clean up pasted code
Remove the extra indentation from a code snippet you copied out of a nested block.
Fix indented text copied from emails and documents
Take the leading indent away from quoted or indented text so it lines up with the rest of your document.
Prepare text for a form or a markdown file
Remove the indentation before you paste text into a place where leading spaces cause problems.
Tidy notes and lists
Clear the indentation from notes or lists that were copied with extra spaces at the start of each line.
Share clean snippets
Unindent a code or text example before you post it in a chat, a ticket or a document.
Tool information
| Tool type | Unindent text (remove indentation from lines) |
|---|---|
| Input | Plain text, pasted or typed in the Input text box |
| Indent size (default) | 2 |
| Remove all (default) | Off |
| Output | The unindented text in the Result box |
| Copy | Copy result button |
| Download format | .txt (plain text) |
| Processing | In the page with JavaScript (client-side) |
Benefits
- Saves time compared with deleting leading spaces line by line.
- Two options: remove a set indent size, or clear all the indentation.
- Handy for pasted code and copied text.
- Copy or download the result in one click.
- Works in the browser page, with nothing to install.
Limitations
- It works with plain text. The code shows no file upload, so paste your text into the box.
- It is made to change the start of the lines. It does not edit the words in your text.
- It has two options only: indent size and remove all.
- Check the result if your text mixes tabs and spaces, because the tool code does not say how each is handled.
- The download is a .txt file only.
Privacy
This tool processes your text in the page using JavaScript, and no network request was found in the tool code. Even so, do not paste confidential information such as passwords or private data.
Tips
- Use Load example first to see how the result looks.
- If your lines are indented by different amounts, turn on remove all.
- If you want to remove just one level of indentation, set the indent size to the size of one level.
- Press Clear before you paste new text so old text does not stay in the tool.
Frequently asked questions
How do I remove indentation from text online?
Paste your text into the Input text box. The tool removes the indentation from the start of the lines, and the result appears in the Result box.
How do I unindent code?
Paste your code into the input box and set the indent size to the amount you want to remove. The default is 2. Turn on remove all to clear all the indentation.
How do I remove all the leading spaces from every line?
Turn on the remove all option. It is off by default.
What is the indent size?
It is the amount of indentation the tool removes from each line. The default is 2.
What does the remove all option do?
It clears all the indentation from the start of the lines, instead of removing only the amount set in the indent size.
Can I copy or download the result?
Yes. Press Copy result to copy it, or Download .txt to save it as a plain text file.
Is my text uploaded to a server?
The tool processes text in the page with JavaScript, and no network request was found in the tool code. Still, avoid pasting confidential information.
Does this tool change the words in my text?
No. It is made to remove indentation from the start of the lines, not to edit the words.