DevTools Logo

Prefix & Suffix Lines Tool

Prefix & Suffix Lines Tool

Add a prefix, suffix, or number to each line with literal-only filters and a live preview.

Runs in your browser
Try an example

Lines

Decorated lines

Paste lines to add a prefix or suffix

Results update as you type. Nothing leaves your browser.

Details

Adding the same characters to the start of every line is a recurring text-wrangling chore that usually means reaching for sed, awk, or a fragile find-and-replace pattern. This tool does it with literal text only: enter a prefix, suffix, or both and the preview updates as you type. Skip empty lines so blank separators stay blank, target only lines that contain (or do not contain) a plain string, or insert numbers with a {n} placeholder in the prefix. Numbering counts decorated lines only, so a filtered subset stays contiguous. Each line keeps its original LF, CRLF, or CR terminator, and a leading BOM is preserved. Nothing is uploaded — all processing happens in your browser tab.

More examples

Quote a log reply

Input:
GET /api/users 200
GET /api/orders 500

Retry the failing request

Prefix: > 
Skip empty lines: on

Output:
> GET /api/users 200
> GET /api/orders 500

> Retry the failing request

Blank separator rows stay blank, so the quoted reply keeps its original structure.

Number only matching lines

Input:
GET /api/users
GET /health
POST /api/orders

Prefix: {n}. 
Numbering: start 1, step 1, pad 2
Filter: contains /api/

Output:
01. GET /api/users
GET /health
02. POST /api/orders

The counter advances only on decorated lines, so numbering stays contiguous across a filtered set.

Build a paste-ready CSV column

Input:
alpha
beta
gamma

Suffix: ,
Skip empty lines: off

Output:
alpha,
beta,
gamma,

A suffix adds the delimiter to each line without touching the line content itself.

    Examples

    Quote a log reply

    Input
    GET /api/users 200
    GET /api/orders 500
    
    Retry the failing request
    Output
    > GET /api/users 200
    > GET /api/orders 500
    
    > Retry the failing request

    Prefix > with skip-empty on keeps blank separator rows blank.

    Number the matching lines only

    Input
    GET /api/users
    GET /health
    POST /api/orders
    Output
    01. GET /api/users
    GET /health
    02. POST /api/orders

    Prefix {n}. with pad 2 and a contains '/api/' filter; the counter skips unmatched lines.

    Add a trailing comma

    Input
    alpha
    beta
    gamma
    Output
    alpha,
    beta,
    gamma,

    A suffix alone decorates every line while the content stays untouched.

    Use cases

    Quote email replies

    Prefix log excerpts or pasted conversation lines with > so they render as quotes without editing each row.

    Build import and command lists

    Turn a list of hostnames into ssh user@{line} commands or a list of values into a comma-delimited column.

    Mark up code and checklists

    Add # for Python comments, - [ ] for Markdown checkboxes, or // TODO: to lines containing a literal path.

    Number a filtered subset

    Use {n} in the prefix with start, step, and padding so only decorated lines receive contiguous numbers.

    Common mistakes

    Mistake:Putting {n} in the suffix or leaving numbering on with no placeholder.

    Fix:Numbering only replaces {n} in the prefix; everywhere else it stays literal text.

    Mistake:Expecting wildcard or regex behavior from the match text.

    Fix:Match text is a plain literal: ( , .* and $1 match exactly those characters, not patterns.

    Mistake:Appending a suffix after trailing spaces, producing words like 'word ,'.

    Fix:Turn on trim before suffix to remove trailing whitespace from decorated lines first.

    Frequently asked questions

    How do I add characters to the start of every line?

    Type the characters into the Prefix field. The preview updates as you type, and the characters are inserted literally: (, *, . and $ have no special meaning. Add a suffix or a separator between the prefix and the content if you need more than one piece.

    Can it skip blank lines, and what counts as blank?

    Yes. Skip empty lines is on by default. A line is considered blank when it is empty or contains only whitespace, and it is left byte-for-byte unchanged. A warning reports how many lines were skipped, and turning the option off decorates them too.

    Can I number lines starting from a value other than 1?

    Turn on Number lines and put {n} in the prefix, for example '{n}. ' or 'Line {n}: '. Set Start to any non-negative number, Step to a positive increment, and Pad to a width from 0 to 6 for zero-padded output such as 01 and 02. Every occurrence of {n} in the prefix is replaced. A {n} in the suffix or separator stays literal.

    How do I change only the lines that contain certain text?

    Choose Contains or Not contains in the line target control and type the match text. Matching is a plain case-sensitive string comparison; turn on Ignore case when needed. An empty match text targets all lines, and if nothing matches the result stays identical with a warning. Numbering counts only the lines that were decorated, so numbers stay contiguous.

    Does the tool change line endings, whitespace, or my privacy?

    Each line keeps its own LF, CRLF, or CR terminator, and a leading byte order mark is preserved. Trailing whitespace is removed only when you enable Trim before suffix. Nothing leaves your browser: there is no upload, no server call, and no content telemetry, so pasted logs and code stay in your tab.

    References & standards