User Rating 0.0
Total Usage 0 times
0 lines, 0 characters
Presets:
0 lines, 0 characters
Is this tool helpful?

Your feedback helps us improve.

About

Manually prepending or appending strings to hundreds of lines introduces transcription errors and costs measurable time. This tool applies a user-defined prefix (P) and suffix (S) to every line (Li) of an input text block in a single operation. It handles edge cases that naive find-and-replace misses: empty lines, trailing whitespace, inconsistent line endings (CRLF vs LF). The output is deterministic - given the same input and parameters, the result is always identical. Use it for SQL column wrapping, HTML list generation, CSV field quoting, log annotation, or bulk code commenting.

The tool assumes UTF-8 input. Lines are split on newline boundaries. An optional line-numbering mode zero-pads indices to maintain column alignment. Note: applying a prefix or suffix to an empty line still produces output unless the "Skip Empty Lines" option is active. For whole-text mode, the prefix and suffix are applied once to the entire block, not per line.

prefix suffix tool text formatting bulk text editor add text to lines line prefix text wrapper

Formulas

The transformation applied to each line is a simple concatenation operation:

Oi = P + Li + S

Where Oi is the output line at index i, P is the prefix string, Li is the original input line at index i, and S is the suffix string. When line numbering is enabled, the formula extends to:

Oi = P + pad(i + 1, w) + D + Li + S

Where pad(n, w) zero-pads the number n to width w = floor(log10(N)) + 1, N is the total line count, and D is the delimiter string (default: ". "). The skip-empty-lines filter applies a predicate before transformation: only lines where Li.trim().length > 0 are processed.

Reference Data

Use CasePrefixSuffixExample Input LineExample Output Line
SQL Quoting"",john_doe"john_doe",
HTML List Items<li></li>Apples<li>Apples</li>
CSS Comments/* */old rule/* old rule */
Markdown Bold****important**important**
CSV Quoting""Hello, World"Hello, World"
Log Timestamps[2024-01-15] Server started[2024-01-15] Server started
Bullet PointsFirst item• First item
XML Tags<item></item>Widget<item>Widget</item>
Line Comment (JS)// deprecated call// deprecated call
Shell Echoecho ""Helloecho "Hello"
Parentheses Wrap()sub-expression(sub-expression)
Numbering01. Chapter One01. Chapter One
Python Printprint("")debug valueprint("debug value")
Tab Indent\tnested line\tnested line
Hashtag#coding#coding
Email Quoting> Original message> Original message
Array Element (JS)"",apple"apple",
LaTeX Command\textbf{}theorem\textbf{theorem}

Frequently Asked Questions

The tool normalizes all line endings to LF (\n) before processing. Input containing \r\n (CRLF) or standalone \r (CR) is converted. The output always uses LF line endings. If your downstream system requires CRLF, paste the output into an editor that can convert line endings (e.g., Notepad++ → Edit → EOL Conversion).
The prefix and suffix are still applied to that empty line. For example, with prefix "
  • " and suffix "
  • ", an empty line produces "
  • ". Enable "Skip Empty Lines" to exclude lines where the trimmed content has zero length. Those lines are removed entirely from the output - they are not preserved as blank lines.
  • The tool processes the prefix and suffix as literal strings. If you type \t in the prefix field, it appears as the two characters backslash-t. The "Interpret Escape Sequences" option converts \t to a real tab character and \n to a newline. This is useful for generating indented code or multi-line wrapped output.
    When both are active, line numbers are assigned only to non-empty lines. If your input has 10 lines but 3 are empty, the output will have 7 lines numbered 1 through 7. The numbering reflects the output sequence, not the original line positions. Zero-padding width is calculated from the final count of included lines.
    The tool handles inputs up to approximately 1 million characters without noticeable delay. String concatenation in modern JavaScript engines (V8, SpiderMonkey) is highly optimized with rope data structures. Processing 10,000 lines typically takes under 5 ms. For extremely large inputs (over 5 MB), consider splitting the text into chunks. The tool does not use Web Workers for this operation because the overhead of message passing would exceed the processing time.
    Set the prefix to a single quote ('), set the suffix to a comma and single quote (',), then paste your list. The last line will have a trailing comma - remove it manually or use a trim step. For example, input lines "Alice", "Bob", "Carol" become "Alice", "Bob", "Carol", - you delete the final comma. The presets include an SQL quoting example for this exact workflow.