EditSafely

Flatten a List

Remove all indentation levels. Runs entirely in your browser, so your data never leaves your device.

0 chars · 0 lines

Output

The result appears here as you type.

Options

How to use Flatten a List

  1. 1. Paste your indented list. Put your nested or indented list into the input pane, such as a tree of items where sub-items are indented under their parent.
  2. 2. Decide whether to drop empty items. Turn on Drop empty items to remove blank lines from the result along with the indentation. Leave it off if you want to keep blank lines as spacing.
  3. 3. Copy the flattened list. Copy the output, with every line's leading whitespace stripped so all items sit at the same level, ready for tools that expect a flat list.

When to use Flatten a List

Flatten a List strips leading whitespace from every line, turning a visually nested list into one flat sequence of items at the same indentation level. Use Flatten a List whenever indentation was meaningful for reading but is now getting in the way of processing.

  • Preparing a nested outline for a CSV import. An outline exported from a notes app has sub-items indented under headings, but the CSV importer needs one flat item per row. Flatten it before pasting into the importer.
  • Cleaning up copy-pasted code or config for a wordlist. You copied a tree-structured list where items were indented under categories and just need the plain values. Flatten the list to strip the indentation and keep the words.
  • Undoing accidental indentation from a text editor. Auto-indent in your editor added leading spaces to a list you did not want nested. Flatten the list to reset every line back to the left margin.
  • Simplifying a tree view export before further processing. A file tree or folder listing was copied with indentation showing depth, but a script needs a flat list of names. Flatten it and drop empty items before scripting further.

Examples

Flatten a nested list

Input

apples
  bananas
    cherries

Output

apples
bananas
cherries

About the Flatten a List tool

Flatten a List does its work locally, right in the browser. Remove all indentation levels. There is no upload step, no queue and no account, and your data never travels over the network.

It belongs to the List Tools collection on EditSafely, a set of 114 small, focused List utilities that share the same instant, private workspace.

You can shape the output with the Drop empty items setting, and the result refreshes the moment you change it. A worked example further down the page shows exactly what the tool produces for a real input.

Running locally also makes the tool fast and dependable: results appear as you type or drop a file, there is no server outage that can take it down mid-task, and confidential data can be processed without a second thought.

Frequently asked questions

Does Flatten a List cost anything?

Yes, it is completely free. All 2,658 tools on EditSafely work without an account, a subscription or usage limits.

Is it safe to paste sensitive or confidential data?

No data leaves your device. The whole tool is JavaScript that runs inside your browser tab, so there is no upload, no server-side processing and no log of what you did. If you disconnect from the internet after the page loads, it keeps working.

How much text can I process at once?

There is no fixed limit. Because the work happens on your own device rather than on a shared server, the practical ceiling is your machine's memory, which comfortably handles inputs far larger than typical online tools allow.

Do I need to sign up or install anything?

Nothing to install and no account needed. Open the page in any up-to-date browser, including on a phone or tablet, and the tool is ready.

How do I use the result?

The output panel has a one-click copy button, and you can keep refining the input while you work; the result updates in place as you type.

Related tools

All List Tools