Trim Lines
Cut, shorten or split every line of a list in one step, with a before-and-after view.
Every line is trimmed the same way. Nothing leaves your device.
How to trim each line
Each character you type is stripped.
Type \t for a tab.
1 is the first field; −1 is the last, −2 the one before it.
Before and after
cut removed text… added
| Line | Before | After |
|---|
About the Trim Lines
Paste a list and trim every line the same way in one step. Remove a fixed number of characters from the start or end (item codes, file extensions), shorten long lines to a maximum length with an ellipsis, strip quotes, commas or other characters from the ends, or keep only the text before or after a delimiter — or one field of a comma-, tab- or space-separated line.
The Before and after table shows every line with the removed text struck through, so you can check the result before you copy it. Characters are counted the way you see them: an emoji or an accented letter is one character. Windows line endings are kept. For general clean-ups such as double spaces and blank lines, use the Whitespace Remover.
How to use it
- Paste your lines, or use Open file (or drop a file on the box) for a .txt, .csv or .log file.
- Choose how to trim each line, for example Remove the first characters or Keep one field (column).
- Set the options that appear: the number of characters, the maximum length, the characters to strip or the delimiter and field.
- Check Before and after — removed text is struck through — then copy or download the result. Use as input lets you apply a second trim.
Examples
ID-001 Apple ID-002 Pear ID-003 Mango
Apple Pear Mango
How to brew better coffee at home Short title
How to brew better… Short title
asha vikram.iyer
Choose Keep text before or after a delimiter, delimiter Other… and type @.
"Asha Rao", Pune, 2024 "Vikram Iyer", Chennai, 2023
Pune Chennai
Common uses
- Removing line numbers, codes, prefixes or file extensions from exported lists.
- Shortening product names, titles or log lines to a length limit.
- Unquoting values copied from code, CSV files or spreadsheets.
- Pulling one column out of comma-, tab- or space-separated data without a spreadsheet.
What each option does
- Remove the first / last characters — removes N characters from every line; shorter lines become empty.
- Cut to a maximum length — lines longer than the limit are cut. The ending (… or ...) counts towards the limit unless you untick it, and Cut at a space avoids splitting a word when there is a space before the limit.
- Strip characters from the ends — removes spaces and tabs, quotes, commas, full stops, semicolons and any other characters you type, from the start, the end or both. Tick At most one character from each end to remove a single pair of quotes and keep the rest.
- Keep text before or after a delimiter — splits each line at the first or last delimiter and keeps one side.
- Keep one field — splits each line at every delimiter and keeps field N (1 is the first, −1 the last).
For the last two, choose what happens to lines without the delimiter: keep them, make them empty or remove them.
How characters and lines are counted
A character is what you see as one symbol: an emoji with a skin tone, a flag or an accented letter typed as two code points all count as one, so they are never cut in half. Each line is trimmed on its own; the line breaks between lines are kept exactly as they were, including Windows (CRLF) endings in opened files.
Limitations
- Fields are split at every delimiter, including delimiters inside quoted values such as "Mumbai, India". Use the CSV to JSON Converter for CSV files with quoted commas.
- Wide characters (Chinese, Japanese) count as one character each, so a maximum length is not a display width.
- The before-and-after table shows the first 200 lines; the result always includes every line.
Privacy
Everything happens in your browser. What you enter or open here is not uploaded or stored by MySmartCoPilot.
Frequently asked questions
How do I remove the first 3 characters of every line?
Choose Remove the first characters and enter 3. Lines with 3 characters or fewer become empty.
How do I remove everything after a comma?
Choose Keep text before or after a delimiter, delimiter Comma, keep Text before, and the First delimiter. Lines without a comma are kept unchanged unless you choose to empty or remove them.
How do I shorten lines without cutting words in half?
Choose Cut to a maximum length and tick Cut at a space, not inside a word. If a single word is longer than the limit, it is cut at the limit.
Is this the same as removing extra spaces?
Stripping spaces here removes them only at the ends of lines. To collapse double spaces, remove blank lines or convert tabs, use the Whitespace Remover.
Is my text uploaded?
No. Every line is trimmed in your browser, and nothing you paste or open is sent anywhere.