Staaarter

CSV Spacer

Pretty-prints CSV for human readability by inserting extra spaces right after each delimiter, so every column's cells start at the same character position across all rows, while keeping the actual delimiter characters (commas, or your chosen delimiter) intact throughout. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-29
By Staaarter Team
csvformattingreadability

Overview

Introduction

A raw CSV file is easy for a program to parse but hard for a human to eyeball, especially when cell widths vary wildly from row to row. CSV Spacer fixes the human-readability side without giving up the delimiter structure.

It adds just enough trailing space after each delimiter so every column starts at the same character position down the page, a classic terminal trick (similar to the `column -t` command) applied specifically to CSV.

What Is CSV Spacer?

A CSV pretty-printer that keeps every delimiter character in place and pads the space immediately after each one, so column boundaries visually align across all rows.

This is deliberately different from a fixed-width columns converter: that family of tools removes delimiters and pads cell content itself; CSV Spacer keeps commas (or your chosen delimiter) as the literal separator and pads around them instead.

How CSV Spacer Works

Every cell is first escaped with the same minimal-quoting rule used across this category, so a field that needs quotes gets them before its width is measured.

For each column, the tool finds the widest escaped cell across all rows, then for every row it inserts a delimiter followed by just enough spaces so the next column's cell always starts at the same character offset.

When To Use CSV Spacer

Use this when you want to eyeball a CSV in a monospace viewer (a terminal, a plain-text editor, a code block) and need the columns to actually line up.

It's also handy for a quick side-by-side visual diff of two similarly-shaped CSVs, aligned columns make mismatched values easier to spot at a glance.

Often used alongside CSV Size Optimizer, CSV Viewer and CSV Colorizer.

Features

Advantages

  • Keeps the delimiter characters intact, so the output still visually reads as "a CSV", just a nicely aligned one.
  • Column widths adapt automatically to the widest cell in each column, no manual width tuning needed.
  • Quoting is resolved before alignment, so a field needing quotes never breaks the padding.

Limitations

  • The output isn't guaranteed to round-trip back to the exact original text if re-parsed, the added padding spaces become part of an unquoted field's literal value.
  • Very wide CSVs (many columns, or one very long cell) can produce lines too wide to view comfortably without horizontal scrolling.

Examples

Aligning a small CSV

Input

a,bb,ccc
longvalue,b,c

Output

a,         bb, ccc
longvalue, b,  c

Column 1's width is set by "longvalue" (9 characters), so the short "a" row gets 9 padding spaces after its comma; both rows' second column then starts at the exact same character position.

Best Practices & Notes

Best Practices

  • View the output in a monospace font, proportional fonts will make the alignment look wrong even though the character counts are correct.
  • Use this for eyeballing and printing, not as an input back into another CSV tool, since the padding isn't part of the real data.
  • Pair with CSV Colorizer if you want column boundaries to also stand out by color, not just alignment.

Developer Notes

Column widths are computed once over the already-escaped grid (so quoting is resolved before measurement), then each row is built by appending `delimiter + " ".repeat(columnWidth - cellLength + 1)` after every non-final cell, guaranteeing the next column's start offset is identical across every row regardless of that row's actual cell length.

CSV Spacer Use Cases

  • Eyeballing a CSV's columns in a terminal or plain-text code block without opening a spreadsheet program
  • Producing a nicely aligned CSV snippet to paste into documentation or a bug report
  • Visually comparing two similarly-shaped CSVs side by side, aligned columns make differences easier to spot

Common Mistakes

  • Feeding the padded output back into another CSV-parsing tool and being surprised the padding spaces show up in the parsed values.
  • Viewing the output in a non-monospace font and concluding the alignment logic is broken.

Tips

  • If the output looks misaligned, double-check you're viewing it in a monospace font, that's the most common cause.
  • For truly delimiter-free fixed-width columns, use CSV to Text Columns Converter instead, this tool keeps delimiters on purpose.

References

Frequently Asked Questions