Cut a fixed number of characters off the start or end of every line, shorten each line to N characters, or delete everything before or after a marker such as a colon, dash or tab. A live preview shows exactly what is removed from each line.
Last updated:
chars
chars
chars
What gets removed
removed kept
Advertisement
Advertisement
How to use the Trim Characters from Lines
Paste your lines into the left box, one item per line.
Pick a mode: remove first / last N, keep first / last N, remove before a marker or remove after a marker.
Enter the numbers or the marker, for example remove 3 characters from the start, or everything before the first colon.
Check the preview: struck-through text is what gets cut from each line.
Copy or download the result, or press Use result as input to apply a second trim.
Which trim mode do I need?
Every mode works line by line: the text is split at each line break, the same rule is applied to each line, and the lines are joined back together. The examples use the input line 3. Cherries: 500 g.
Goal
Mode and settings
Result
Strip list numbering
Remove first / last N: start 3
Cherries: 500 g
Drop a unit at the end
Remove first / last N: end 2
3. Cherries: 500
Shorten long lines
Keep first N: 11, marker …
3. Cherries…
Keep a fixed-width code at the end
Keep last N: 5
500 g
Keep only the value
Remove before marker :, marker removed
500 g
Keep only the label
Remove after marker :, marker removed
3. Cherries
Keep the label with its colon
Remove after marker :, marker kept
3. Cherries:
Practical uses
Cleaning copied lists: remove numbering such as 01) , bullet characters or checkbox marks pasted from documents.
Log files: cut the timestamp at the start of each log line (for example the first 20 characters of 2026-01-15 08:30:12 ) or everything before the first ].
File paths and URLs: use Remove before marker with / and last occurrence to keep only file names, or Remove after marker with ? to strip query strings.
Key/value data: split name=value or Name: value lines into just the keys or just the values.
Fixed-width exports: keep the first N characters to pull out a column from a fixed-width report.
How characters are counted
Computers store text as code units, which is why some tools cut emoji in half and leave a broken symbol. This tool counts grapheme clusters, the characters you actually see, using your browser's built-in Unicode text segmentation. That means é written as e plus an accent mark, a flag like 🇨🇦 (two regional letters) and a family emoji (several emoji joined) each count as one. Spaces and tabs count as characters too, so turn on Trim spaces before cutting if your lines have uneven indentation and you want to count from the first visible character.
Frequently asked questions
How do I remove the first 3 characters from every line?
Choose Remove first / last N, type 3 in Remove from start and 0 in Remove from end. Each line loses its first three characters; lines shorter than that become empty.
How do I delete everything before a colon on each line?
Choose Remove before marker and type : as the marker. Tick Also remove the marker to drop the colon too, and keep Trim spaces left after cutting on so the space after the colon disappears as well.
What is the difference between first and last occurrence?
If a line contains the marker several times, first occurrence cuts at the earliest one and last occurrence cuts at the final one. For a file path like docs/2024/report.pdf, removing everything before the last / leaves just report.pdf.
What happens to lines that do not contain the marker?
By default they are kept unchanged. You can also make them empty or delete them completely, which is handy for cleaning up lists where only some lines have the format you want.
Does an emoji count as one character?
Yes, with Count emoji and accented letters as 1 character ticked, the tool counts what you see on screen (grapheme clusters), so a flag or a family emoji is never split in half. Untick it to count Unicode code points instead.
Can I remove characters from both ends at once?
Yes. In Remove first / last N mode you can enter a number for the start and the end together, for example 2 and 1 turns [abc] into bc.
Is my text sent to a server?
No. All trimming happens in your browser with JavaScript, so your text stays on your device. Only your option settings are remembered locally.
Are all the tools on FreeToolCabin tested for quality and accuracy?
Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.