TextModifier™

How to Add Prefix and Suffix to Every Line Online

Need to wrap hundreds of lines in HTML tags, add quotes around every entry, or append commas to each line? Here's how to do it in seconds without writing a single regex.

TL;DR: Need to wrap hundreds of lines in HTML tags or add quotes, commas, or custom text to every line? The Add Prefix/Suffix into Line tool lets you transform all your lines in one click, with presets for common formats and full control over trimming and line ranges. Everything runs in your browser.

You have a list of 500 product names and need each one wrapped in <li> tags. Or a column of email addresses that need quotes and commas for a SQL query. Doing this by hand means hundreds of repetitive edits, and one missed line breaks everything.

TextModifier's Add Prefix/Suffix into Line tool adds any text to the beginning and end of every line, instantly and without errors.

What Is a Line Prefix and Suffix?

A prefix is text inserted at the start of each line. A suffix is text appended at the end. Together, they let you wrap every line in a consistent format.

For example, given this input:

Apple
Banana
Cherry

With prefix <li> and suffix </li>, you get:

<li>Apple</li>
<li>Banana</li>
<li>Cherry</li>

You can use a prefix alone, a suffix alone, or both together.

How to Use the Tool

  1. Paste your text into the input area
  2. Enter your prefix (text to add before each line)
  3. Enter your suffix (text to add after each line)
  4. The output updates in real time

No buttons to click. The result appears as you type. Copy the output or save it as a file.

Built-In Presets for Common Formats

Instead of typing common wrappers manually, use the Presets dropdown. One click fills both the prefix and suffix fields:

  • Double Quotes: wraps each line in "..."
  • Single Quotes: wraps each line in '...'
  • Parentheses: wraps each line in (...)
  • Square Brackets: wraps each line in [...]
  • Curly Braces: wraps each line in {...}
  • HTML <li>: wraps each line in <li>...</li>
  • HTML <p>: wraps each line in <p>...</p>
  • SQL Values: wraps each line in ('...') with trailing commas
  • Comma Suffix: appends a comma to each line
  • Tab Prefix: indents each line with a tab character

Presets save time on the formats developers and data professionals use most.

Advanced Options

Skip Empty Lines

Enable Skip empty lines to leave blank lines untouched. Without this, the tool would add your prefix and suffix to empty lines too, creating lines that contain only the wrapper text.

Trim Lines

Enable Trim lines to remove leading and trailing whitespace from each line before adding the prefix and suffix. This cleans up inconsistent indentation from the source text.

Apply to a Specific Line Range

Enable Line range to restrict the operation to a subset of your text. Set the From and To line numbers, and only lines within that range receive the prefix and suffix. Lines outside the range pass through unchanged.

Set To to 0 to apply from the starting line through the end of the text.

Real-World Use Cases

Generating HTML Lists

Paste a plain list of items, apply the <li> preset, and wrap the output in <ul> or <ol> tags. You've built a complete HTML list from raw text without opening a code editor.

Building SQL INSERT Statements

Take a column of values, apply the SQL Values preset to get ('value'), on each line, then remove the trailing comma from the last line. Your INSERT statement is ready.

Preparing CSV or JSON Arrays

Add double quotes and a comma suffix to create a quoted, comma-separated list from plain text. Copy it into a JSON array or CSV column.

Adding Code Comments

Use // as a prefix (with a trailing space) to comment out every line in a code block. Or use # for Python and shell scripts.

Wrapping Lines for Markdown

Add - as a prefix to convert a plain list into a Markdown bullet list. Use 1. to create numbered lists.

Line Ending Support

The tool supports both Unix (LF) and DOS (CRLF) line endings. Choose the correct format for your target platform before copying or saving the output.

Privacy and Speed

TextModifier processes everything in your browser. No text is uploaded to a server. No accounts, no tracking, no data storage. The transformation happens instantly on your device.

Start Adding Prefix and Suffix to Your Text

Stop editing lines one by one. Paste your text into the Add Prefix/Suffix into Line tool and transform every line in one step.

Ready to manipulate some text?

Browse all available tools and get started in seconds.

Browse Tools

Take your tools on the go

Download the TextModifier™ app for quick access to all your favorite text tools, anytime, anywhere.