Text tools

Text to columns

Text to columns. Runs entirely on your device, nothing is uploaded.

Runs on your device. The file is never uploaded.

Text to columns spreads the non-empty lines of a file down and then across a grid, the way a default ls listing reads. columns is required, gutter defaults to two spaces, and each column is padded to its own longest item. Padding counts UTF-16 units, so CJK characters and emoji drift out of alignment.

Input

Options

Questions

How are the items laid out across the columns?

Down first, then across, the way the default ls listing works. With 12 items in 3 columns, items 1 to 4 fill the first column, 5 to 8 the second, and 9 to 12 the third. Each column is padded to the width of its own longest item, so the columns line up, and the trailing padding on each row is trimmed off.

Does it wrap long lines or reflow paragraphs?

No. Each input line is one item and is never split, so a line longer than the others simply makes its column wide. This is a layout tool for a list of short items, not a word wrapper. If you feed it prose, every sentence-length line becomes one enormous column entry.

What happened to my blank lines?

They were dropped. Only lines with at least one character are treated as items, so blank lines in your input do not become empty cells. That is what makes a list with stray blank lines between sections come out evenly packed. An input that is entirely empty produces an empty result rather than an error.

How do I change the spacing between columns?

With the gutter option, which is free text and defaults to two spaces. Put a tab in it, or a pipe with spaces around it, and that string is inserted between every pair of columns. The columns option has no default and is required: it must be a whole number of 1 or more, and anything else is refused with "columns must be a whole number of 1 or more".

Why are my columns misaligned when the text has emoji or CJK characters?

Because padding is measured in UTF-16 code units, not in display width. A CJK character usually occupies two terminal cells but counts as one unit, and an emoji can count as two units while occupying two cells. Either way the arithmetic and the rendering disagree and the columns drift. It aligns correctly for plain ASCII lists.

Related Text tools