Skip to content
gohacks.dev
Tooling

Align Text Into Columns

Line up assignments, key-value pairs or comments by padding before a separator such as =, :, => or #, keeping comments and lines without it unchanged.

Free · No sign-up · Your inputs stay in your browser

Input

Align text into columns on a separator

Output

Aligned

134 characters

Lines without the separator, comments and blank lines are left exactly as they were. Aligned assignments read well but make diffs noisy, since adding one longer key re-indents every line: many style guides (and PHP-CS-Fixer's default) align only within a block for that reason. Note that a .env value with spaces before = is not parsed the same way by every loader.

Runs in this browser. Nothing you paste is sent to a server.

Readable blocks

Aligned key-value blocks in .env files, YAML, PHP arrays and Makefiles are easier to scan. The cost is in version control: adding one longer key re-pads every line in the block and the diff grows, which is why many style guides and formatters only align within small blocks, or not at all.

Check the file format

Some formats are sensitive to the padding. A .env value with spaces around the equals sign is not parsed the same way by every loader, so test before aligning one.

Share

Frequently asked questions

Can it align on the second occurrence of a separator?
No. Lines are split at the first occurrence, which suits assignments and key-value pairs.
How do I align columns in a shell?
column -t aligns whitespace-separated columns, and column -t -s= aligns on a separator.
Is what I paste sent anywhere?
No. The tool runs entirely in your browser with JavaScript. Nothing you type or paste is sent to our server or stored.

Keep planning

Similar tools