Add a Prefix to Text Lines

Add a prefix to every line of text with the Add a Prefix to Text Lines Tool. Customize the prefix, add line numbers, and trim or skip empty lines. Clean and format your text instantly with live preview, file import, export, and copy options.

Paste your input above or import a file below.
No file chosen
Supported file types: .txt, .csv, .tsv, .log, .md, .ini, .html, .htm, .css
Total characters: 0
Options
Ignore empty lines
Trim lines before prefixing
Add line number before prefix

How to Use:

  1. Paste your text into the Input Text box.
  2. Enter your desired prefix (e.g., “-> ” or “Line: “).
  3. Use the options to ignore empty lines, trim lines first, or include line numbers.
  4. The result appears in the Modified Output box.
  5. Click Copy Output or Export to File to use it.
  6. Use Choose File to import supported file types.

What Add a Prefix to Text Lines Tool Can Do:

This tool adds a custom prefix to every line of your input. You can trim whitespace, skip empty lines, or add line numbers before the prefix. It’s ideal for formatting, labeling, coding, or organizing data line-by-line.

Example:

Input:

first line
second line

third line

Options:

  • Prefix: ->
  • Ignore empty lines: On
  • Trim lines before prefixing: On
  • Add line number before prefix: Off

Output:

-> first line
-> second line
-> third line

Common Use Cases:

Use it to prepare data for coding, add markers for processing scripts, format Markdown checklists, create numbered logs, or prefix lines for organized note-taking.

Useful Tools & Suggestions:

Once you’ve added prefixes to each line, Remove Line Numbers can be helpful if you’re reworking content that was previously numbered. And to make the final output cleaner, especially if alignment shifted, Normalize Text Spacing smooths out any visual hiccups.