Free Toolkit

Prefix/Suffix LinesAdd a prefix and/or suffix to each line of text.

Prefix/Suffix Lines illustration
📝

Prefix/Suffix Lines

Add a prefix and/or suffix to each line of text.

How to Use
1

Paste Text

Paste the text to modify.

2

Set Prefix/Suffix

Enter text to add before and/or after each line.

3

Copy Result

Copy the text with prefixes and suffixes applied.

What Is Prefix/Suffix Lines?

The Prefix/Suffix Lines tool adds custom text to the beginning (prefix) and/or end (suffix) of every line. You can set a prefix, a suffix, or both. An optional toggle skips empty lines so they remain clean. This is useful for formatting code, adding comment markers, creating list markup, wrapping lines in tags, or preparing text for specific formats.

Why Use Our Prefix/Suffix Lines?

  • Add consistent text to the start or end of every line
  • Option to skip empty lines
  • Combine prefix and suffix in one operation
  • Useful for code formatting and list creation

Common Use Cases

Code Commenting

Add comment markers (// or #) to the beginning of each line.

List Formatting

Add bullet points, numbers, or markers to each line.

HTML Wrapping

Wrap each line in HTML tags like <li> and </li>.

SQL Formatting

Add quotes and commas to values for SQL IN clauses.

Technical Guide

The tool splits the input by newline characters and processes each line. If the skip-empty-lines option is enabled, empty lines (those that trim to an empty string) pass through unchanged. For all other lines, the prefix is prepended and the suffix is appended using simple string concatenation. The processed lines are joined back with newline characters. Both prefix and suffix default to empty strings, so you can use just one or both.

Tips & Best Practices

  • 1
    Use prefix "// " to comment out every line
  • 2
    Use prefix "- " to create a Markdown list
  • 3
    Use prefix "<li>" and suffix "</li>" for HTML list items
  • 4
    Skip empty lines to keep paragraph breaks clean

Related Tools

Frequently Asked Questions

QCan I add just a prefix or just a suffix?
Yes, leave either field empty to only add the other.
QWhat does "skip empty lines" do?
When enabled, empty lines (whitespace-only) are not modified.
QCan I use special characters in the prefix/suffix?
Yes, any text can be used including special characters, HTML tags, and Unicode.
QDoes it work with multi-line prefix/suffix?
The prefix and suffix are added as-is. Multi-character strings work but multi-line ones may produce unexpected results.
QHow is this different from Indent?
Indent adds whitespace specifically. This tool adds any custom text to both the start and end of lines.

About Prefix/Suffix Lines

Prefix/Suffix Lines is a free online tool from FreeToolkit.ai. All processing happens directly in your browser — your data never leaves your device. No registration required. No ads. Just fast, reliable tools.