CSV to Prompt Formatter
Turn a table into eight prompt encodings at once and see what each one costs, with malformed rows reported by line and column instead of dropped.
XML rows costs 241.6% more for the same 4 row(s). Estimates at 4 characters per token; the character counts below are exact.
- Markdown table, padded
- 419 chars · ≈ 105 tokens
- Markdown table, unpadded
- 306 chars · ≈ 77 tokens
- CSV (normalised)
- 220 chars · ≈ 55 tokens
- Tab separated
- 214 chars · ≈ 54 tokens
- JSON, one object per row
- 577 chars · ≈ 144 tokens
- JSON, header row plus arrays
- 434 chars · ≈ 109 tokens
- Labelled records
- 427 chars · ≈ 107 tokens
- XML rows
- 731 chars · ≈ 183 tokens
- Rows in
- 4
- Rows encoded
- 4
- Columns encoded
- 5
- Cells
- 20
- Per-row cost, cheapest encoding
- ≈ 13 tokens
- Round trip clean: the normalised CSV above was parsed back and all 20 cells came out identical.
There is no single right way to put a table in a prompt, and the difference between the choices is not small. The same forty rows can vary by half again in length depending on whether you pad a markdown table, repeat the column names on every row, or send arrays with the header once. On a table you send with every request — a product catalogue, a rate card, a list of the user's recent orders — that difference is paid on every call for as long as the feature exists.
Cheapest is not always best
Arrays with a single header row are almost always the shortest encoding, and they are also the one models most often misalign on wide tables: by column nine there is nothing local telling the model which heading a value belongs to. Labelled records are the most expensive and the hardest to get wrong. Markdown sits in between and has the advantage that models have seen an enormous amount of it. Pick with the cost in front of you rather than after the bill.
The parse is the part that bites
Most rows that go missing in a data pipeline go missing at the CSV parse, not at the model. A comma inside an unquoted name, a quote character in a customer's surname, a row with one field too many — each one silently shifts every value after it into the wrong column, and the model dutifully answers questions about the wrong column. Every one of those is reported above with its line and column, and the normalised CSV is parsed back and compared cell by cell so the claim that quoting survived is demonstrated rather than asserted.