OnlineNotes Logo

    Add Prefix and Suffix to Lines

    Type what goes before and after each line. Every line of your list changes at once, so 500 rows take the same time as 5.

    Options

    About this tool

    Wrapping every line in the same text is one of the most common list chores. A list of IDs needs quotes and commas for a SQL IN clause. A list of names needs <li> tags for a web page. A list of keywords needs a dash in front for a markdown note. Doing it by hand is slow and one missed comma breaks the query.

    The sample shows the SQL case: each value gets a quote before it and a quote plus comma after it. Delete the last comma after you copy, or use the comma separator tool, which joins a list without a trailing comma. Spaces at line ends are trimmed first, so a value copied from a spreadsheet does not end up as 'apple '.

    How it works

    1. Paste your list, one item per line.
    2. Type the text for the start of each line, the end of each line, or both.
    3. Each line is trimmed (if the option is on) and wrapped. Empty lines are left alone when "Skip empty lines" is on.
    4. Copy the result.

    Worked example

    Input

    Home
    About
    Contact

    Output

    <li>Home</li>
    <li>About</li>
    <li>Contact</li>

    With <li> before and </li> after, a plain list becomes HTML list items ready to paste between <ul> tags.

    Edge cases and limits

    • The text is added exactly as typed. To add a line break or tab, type it in the box of a tool that supports \n, such as find and replace with regex.
    • Every line gets the same prefix and suffix. For numbers that count up, use add line numbers.
    • The last line also gets the suffix, so a trailing comma may need to be removed.

    Frequently asked questions

    How do I add a comma to the end of every line?

    Leave "Before each line" empty and type a comma in "After each line". Copy the result.

    How do I add quotes around each line for SQL?

    Type ' before and ', after each line, then remove the last comma. For one long line, use the comma separator tool with single quotes.

    How do I add text to the start of each line in Notepad++?

    Use Find and Replace with regular expressions: find ^ and replace with your text. Use $ to add text at the end. This page does both at once without regex.

    Related tools