Line Prefix Adder

Prepends a chosen prefix to the start of every line in your text, useful for building bullet lists, comment blocks, numbered-style markers, or CLI flag lists from plain lines. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-23

Overview

Introduction

Turning a plain list of lines into bullet points, Markdown list items, or a block of shell flags usually means prefixing every single line the same way, a tedious edit to do by hand in a text editor.

It runs entirely client-side, so nothing you paste is ever uploaded to a server.

What Is Line Prefix Adder?

A line-based prefixing tool that prepends your chosen prefix to the start of every line in the input, rather than just once at the very beginning of the whole text.

It runs entirely client-side as part of this site's String Tools collection, so nothing you paste is ever uploaded to a server.

How Line Prefix Adder Works

The tool splits the input on newline characters, prepends the prefix to each resulting line, and joins the lines back together with newlines.

The transformation happens synchronously in JavaScript the moment you type, with no network round trip involved.

When To Use Line Prefix Adder

Use it to turn a plain list into Markdown bullets ('- '), a numbered-looking list, a comment block, or a set of CLI flags, all prefixed consistently.

It's a fast way to get the answer without opening a code editor, a REPL, or writing a one-off script just to check.

Features

Advantages

  • Applies the prefix to every line in one pass, not just the start of the text.
  • Preserves blank lines and line order exactly.
  • Adds the prefix without trimming anything, so existing indentation survives intact and the prefix simply sits in front of it.

Limitations

  • Adds the same fixed prefix to every line; it can't generate an incrementing numbered list.
  • Does not trim or otherwise alter existing line content.

Examples

Turning lines into a bullet list

Input

apple
banana
cherry

Output

- apple
- banana
- cherry

With prefix '- ', each of the three lines gets the same marker prepended.

Best Practices & Notes

Best Practices

  • Use a trailing space in the prefix (like '- ' or '> ') so the marker doesn't run into the line content.
  • Include a trailing space in the prefix so markers do not run into the content, except when prefixing code where the exact column matters.
  • Think about whether blank lines should be prefixed, since a comment marker on an empty line is usually harmless but a bullet is not.

Developer Notes

The implementation is `input.split("\n").map((line) => prefix + line).join("\n")`, a straightforward per-line map with no trimming or filtering of the resulting lines.

Line Prefix Adder Use Cases

  • Converting a plain list into Markdown bullet points
  • Prefixing every line of a diff or patch snippet
  • Building a list of CLI flags from a list of bare values

Common Mistakes

  • Expecting the prefix to be added only once, at the top of the text, rather than to every line.
  • Prefixing indented code and expecting the marker to follow the indentation; it is placed at the very start of the line, ahead of any leading spaces.

Tips

  • Use Line Suffix Adder alongside this tool to wrap each line with both a prefix and a suffix.
  • Use '> ' to quote text for markdown or an email reply, where every line of the quoted block needs to carry the marker.

References

Frequently Asked Questions