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

Your feedback helps us improve.

About

Prepending a consistent prefix to each line of a text block is a routine operation in data preparation, log formatting, and code commenting. Manual editing across hundreds of lines introduces typos, inconsistent spacing, and wasted time. This tool processes n lines in O(n) time, applying a user-defined prefix string P with a configurable separator S to produce output lines of the form P + S + Li. It handles edge cases: empty lines, trailing whitespace, and optional zero-padded line numbering. The tool assumes UTF-8 input and preserves original line breaks.

add prefix text lines bulk text line prefix text formatting prepend text

Formulas

Each input line Li is transformed by concatenating the prefix P, an optional separator S, and the original line content:

Outputi = P + S + Li

When line numbering is enabled with zero-padding width w, the prefix becomes a composite:

Outputi = P + padStart(i, w, 0) + S + Li

Where P is the user-defined prefix string. S is the separator character (space, tab, colon, or none). Li is the i-th line of input text. w is computed as floor(log10(n)) + 1, where n is the total line count. When the skip-empty-lines option is active, lines where trim(Li).length = 0 are passed through unmodified.

Reference Data

Prefix Use CaseTypical PrefixSeparatorContext
SQL Comments--SpaceDisabling SQL statements in bulk
Python Comments#SpaceCommenting out code blocks
C/Java Comments//SpaceSingle-line comment blocks
Markdown Lists-SpaceConverting plain lines to bullet lists
Ordered Lists1.SpaceCreating numbered Markdown lists
Email Quoting>SpaceQuoting replied text in email or Markdown
Log Tagging[INFO]SpaceCategorizing log entries by severity
Error Tagging[ERROR]SpaceMarking error-level log lines
CSV Field Addvalue,NonePrepending a column to CSV rows
Indentation (4 spaces)NoneAdding indent level to code blocks
Tab Indentation\tNoneAdding tab-based indentation
HTML List Items<li>NoneWrapping lines in list item tags
Bash EchoechoSpaceConverting text lines to shell echo commands
Git Commit Prefixfix:SpaceConventional commit message formatting
Timestamp2024-01-15SpaceDate-stamping log or journal entries
Namespaceapp.NoneAdding namespace prefix to config keys
TODO MarkerTODO:SpaceMarking lines as action items
Checkbox (MD)- [ ]SpaceCreating Markdown task lists
Arrow IndicatorSpaceVisual indicators in documentation
Custom Label[REVIEW]SpaceFlagging lines for peer review

Frequently Asked Questions

By default, the prefix is applied to every line including empty ones. When the "Skip Empty Lines" option is enabled, lines consisting solely of whitespace (after trimming) are passed through without modification. This prevents output like a lonely prefix on otherwise blank lines, which is common when commenting out code blocks that contain spacing.
The tool normalizes all line endings to LF (\n) during processing, which is the standard for web-based text handling. If your workflow requires CRLF (Windows-style), paste the output into an editor that converts line endings, or use a secondary tool. The normalization ensures consistent behavior across macOS, Linux, and Windows inputs.
The padding width w is calculated as floor(log10(n)) + 1, where n is the total number of non-skipped lines. For example, 99 lines produce width 2 (01, 02, ... 99), while 100 lines produce width 3 (001, 002, ... 100). This keeps columnar alignment consistent.
Yes. The separator dropdown includes a Tab option that inserts a literal tab character (\t) between the prefix and the line content. You can also select "None" for zero-width joining, which is useful for namespace prefixes like "app." where no space is desired between the prefix and the original text.
The tool processes text synchronously in O(n) time. On modern browsers, inputs up to approximately 100,000 lines (roughly 5 MB of text) process in under 200ms. Beyond that threshold, browser tab memory limits become the bottleneck rather than the algorithm. For extremely large files, consider splitting the input or using a command-line tool like sed or awk.
The "Trim Lines" option removes leading and trailing whitespace from each line Li before the prefix is prepended. This is applied after the skip-empty-lines check. It is useful when pasting text from sources with inconsistent indentation, ensuring the prefix aligns cleanly at the start of each line's actual content.