A cheat sheet for adding a prefix to each line is a compact reference that lists the most common markers — bullets, comment characters, quotes, SQL or shell fragments, log tags, and HTML wrappers — alongside a single tool that applies them literally to every line at once. The browser-based Add Prefix and Suffix to Lines tool is exactly that: paste your lines, type a prefix (or a suffix, or both), and download the decorated result as a UTF-8 TXT file. The transformation is intentionally literal, so characters like brackets, backslashes, dollar signs, asterisks, and parentheses are inserted exactly as typed — there is no regex, no replacement-token expansion, and no Markdown or HTML parsing to surprise you. Up to 1,000,000 characters can be processed, original line order and whitespace stay intact, and the file is generated locally in the browser. That predictability is what makes a cheat sheet of patterns useful in the first place: each pattern can be trusted to do the same thing every time, on any text source, without uploading anything to a server.

What a Prefix-to-Lines Cheat Sheet Actually Covers
Most people who search for a prefix-to-lines cheat sheet are not looking for a long article — they want a quick reference card that maps a recurring editing chore to a known character pattern. The recurring chores fall into a small number of buckets: turning plain text into a bullet or numbered list, adding a comment marker so the text becomes valid in a shell or config file, surrounding identifiers with quotes or parentheses for SQL, JSON, or code, prefixing log lines with a tag or timestamp, and wrapping each line in HTML or XML tags. Once the pattern is identified, the same one-line rule ("if I write - at the start of each line, I get a Markdown bullet list") applies to any input.
A cheat sheet becomes truly useful when the underlying tool is predictable: it should not silently trim spaces, rewrite your punctuation, change case, sort entries, deduplicate values, or drop the last empty line. The Add Prefix and Suffix to Lines tool is documented to do none of those things — it concatenates prefix + original line + suffix for each logical input line, splits on CRLF/CR/LF, normalizes the output to LF, and stops there. That means the cheat sheet you build from it will keep working on the next file, the next colleague's machine, and the next time you paste from a different editor. The same patterns are explained end-to-end in the API-free guide Add a Prefix to Each Line Without an API, which uses this tool as its reference implementation.
How to Add a Prefix to Each Line in Three Steps
- Paste or type the lines you want to decorate. The input accepts up to 1,000,000 characters. The tool preserves line order and the whitespace inside each line, including leading spaces and tabs that you may have used for nested indentation or a code block.
- Enter a prefix, a suffix, or both, and choose whether blank lines stay unchanged. Each prefix and suffix is literal text up to 200 Unicode characters, and at least one of them must be non-empty. A single toggle named Leave blank lines unchanged decides whether empty or whitespace-only lines get decorated or pass through verbatim.
- Generate the exact result, inspect the preview, and download the UTF-8 TXT file. The preview uses a preformatted region so spaces and line breaks render faithfully. Editing any control clears the old result and revokes its download URL, so a stale file cannot be saved by mistake after the controls describe different output.
Common Prefix and Suffix Patterns
The table below is the cheat sheet itself: for each common task, the prefix or suffix you would type into the tool. Spaces and tabs in the markers are intentional — they are inserted exactly as shown.
| Task | Prefix | Suffix |
|---|---|---|
| Markdown unordered bullet | - | (blank) |
| Markdown ordered bullet | 1. | (blank) |
| Shell, Python, or YAML comment | # | (blank) |
| SQL string literal | ' | ' |
| Quoted identifier (JSON-ish) | " | " |
| Comma-delimited line list | (blank) | , |
| HTML list item wrap | <li> | </li> |
| Markdown inline-code span | ` | ` |
| Log timestamp placeholder | [2024-01-15 14:30:00] | (blank) |
| Bracketed checklist marker | [ ] | (blank) |
Two quick notes on using the table. First, a task like "comma-delimited line list" only needs a suffix because the prefix is empty; the tool still runs because at least one of the two markers is non-empty. Second, the markers are real Unicode text, so an emoji such as 📌 or a CJK string such as 注意: works the same way as ASCII — the generated file is a Blob labeled UTF-8 plain text, and the result will render correctly as long as the downstream editor reads UTF-8.
How Blank Lines, Whitespace, and Line Endings Behave
Because the transformation is line-by-line, the behavior around empty lines, whitespace-only lines, and the final newline is where most surprises happen. The tool exposes one explicit toggle for this, and the rest is documented in the operating contract so the result is reproducible.
| Input situation | With "Leave blank lines unchanged" ON | With the option OFF |
|---|---|---|
| Empty line | Returned exactly as empty | Receives prefix + suffix |
| Line containing only spaces or tabs | Returned with the same spaces | Receives prefix + suffix |
| Line containing real content | Receives prefix + suffix | Receives prefix + suffix |
| Trailing newline at end of input | Final empty logical line stays empty | Final empty logical line is decorated |
| CRLF or classic-Mac CR endings | Recognized and normalized to LF | Recognized and normalized to LF |
The toggle never deletes a line — it only decides whether decoration is applied. A line that contains a single space is therefore preserved as that space when the option is on, which is the right behavior if you are keeping visual gaps between paragraphs. If you want every logical line, including the last empty one after a trailing newline, to receive the same marker, turn the option off. A visual wrap in the preview window does not add a real newline to the downloaded file, so long lines stay long lines in the saved TXT.
When to Reach for a Different Tool
The cheat sheet covers literal text decoration, and a few common requests sit just outside it. If you need a sequential number before each line (1, 2, 3 …) rather than a fixed prefix, use Add Line Numbers to Text instead, because number generation, leading zeros, and a custom separator are their own task. If you need to swap one piece of text for another inside each line — for example rewriting foo to bar everywhere — that is a literal substring replacement and belongs in Find and Replace Text. If the result needs to be a JSON array, a SQL IN list, or a CSV row, the dedicated Add Quotes to Each Line tool applies the escaping rules each format actually requires, including the commas and double-quote rules that this cheat sheet deliberately ignores.
Finally, if the cheat sheet feels right but the volume is too large for a single paste buffer — typically many hundreds of thousands of lines — split the source first with the Text File Splitter, decorate each part with the same prefix and suffix, then recombine with the Text File Merger. All three steps still run locally in the browser, so the workflow stays predictable, auditable, and free of uploads, even on files that would otherwise stall a text editor.
Related reading: Add Quotes to Each Line in Notepad++ Without Regex.