macOS guide

Convert Text to CSV on Mac

Three ways to convert text to CSV on a Mac: Apple Numbers for a visual import and export, the Terminal for a fast one-liner, and a Shortcuts or Automator quick action to convert files from Finder.

Step by stepCopy-paste codeFree converter included
Prefer not to code? Use the text to CSV converter — it runs in your browser, free, with nothing uploaded.

Open the converter

Advertisement
Overview

Convert text to CSV on macOS

macOS has everything you need to convert text to CSV without extra software: Numbers handles it visually, the Terminal does it in one line, and Shortcuts can turn it into a right-click action. Pick whichever fits your workflow.

If you would rather not open an app at all, the browser converter works on Safari and any Mac browser, free and private.

Method 1: Apple Numbers

Numbers can open delimited text and export a clean CSV:

  1. Open Numbers and choose File → Open, then select your .txt file. Numbers shows an import dialog.
  2. Pick the delimiter (comma, tab, space or semicolon) so the preview splits into the right columns, then click Import.
  3. When the data looks correct, choose File → Export To → CSV….
  4. Under Text Encoding choose Unicode (UTF-8), then save.

This is the most beginner-friendly route and gives you a quick visual check of the columns before exporting.

Method 2: Terminal one-liner

The Terminal is the fastest option and works well in scripts. macOS includes awk and sed. To convert tab- or whitespace-separated text to comma CSV:

Terminal — tabs to commas
awk 'BEGIN { FS="\t"; OFS="," } { $1=$1 } 1' input.txt > output.csv
Terminal — any whitespace to commas
awk '{ $1=$1; OFS="," } 1' input.txt > output.csv

For fields that may contain commas, install csvkit (pip3 install csvkit) and use csvformat -T input.txt > output.csv so quoting is handled correctly.

Method 3: A Shortcuts or Automator quick action

To convert files straight from Finder, build a one-time action:

  • In Shortcuts, create a shortcut that takes files as input, runs a Run Shell Script step with the awk command above, and saves the result. Enable Use as Quick Action so it appears in Finder’s right-click menu.
  • In Automator, create a Quick Action, add Run Shell Script (pass input as arguments), and use the same command. Saved actions appear under Finder → Quick Actions.

After setup, converting a text file is a single right-click. For converting the result back, see convert CSV to text on Mac.

Good to know

macOS tips and verification

A couple of Mac-specific notes make these methods smoother. Numbers always exports UTF-8 when you choose it in the export dialog, so non-Latin text stays intact; just remember Numbers limits very large sheets, so for huge files the Terminal route is more reliable. If you build a Shortcuts or Automator quick action, test it on a copied file first — a shell step that redirects output can overwrite the original if the paths are not distinct.

The Terminal recipes use the BSD versions of awk and sed that ship with macOS; the commands shown are portable and behave the same as their Linux counterparts for this task. To confirm a conversion worked, run head output.csv to eyeball the first lines, or open the file in Numbers to verify the columns split as expected before relying on it.

If you convert text to CSV often, save the awk command as a shell function in ~/.zshrc so it is always a keystroke away, or expose it through a Shortcuts quick action for a right-click conversion in Finder. Both turn a repeated chore into a single step, and neither sends your data anywhere — the conversion stays entirely on your Mac.

In short, Numbers is the friendliest route, the Terminal is the fastest, and a Shortcuts quick action makes conversion a single right-click. All three keep your data on your Mac, so even sensitive files never leave the machine.

FAQ

Convert Text to CSV on Mac — FAQ

How do I convert text to CSV on a Mac?

Open the text file in Numbers and export to CSV, or run an awk one-liner in Terminal.

Which encoding should I choose in Numbers?

Unicode (UTF-8) keeps accented and non-Latin characters correct.

Can I convert from Finder?

Yes. Build a Shortcuts or Automator quick action with a shell script to convert files on right-click.

Is there a no-app option?

Yes — the online converter runs in any Mac browser.