Free online text tool

Keep First Characters Of Each Line

Keep First Characters Of Each Line cuts every line down to the number of characters you choose. Paste your text, enter a number and copy the result. It is free and runs in your browser.

First Characters from a String Tool

0Character Count
0Character Count (without spaces)
0Word Count
0Sentence Count
0Paragraph Count
0Line Count

Keep the First Few Characters Example

Before (keep 7)
I think I will buy the red car, or I will lease the blue one.
I think I will buy the red car, or I will lease the blue one.
After
I think
I think

Bookmark: press Ctrl+D (Windows) or Cmd+D (Mac) to save this tool.

Suggest a New ToolProvide Feedback on This Tool

What does Keep First Characters Of Each Line do?

This tool keeps the first characters of every line and removes the rest. You choose the number, and each line is cut to that many characters counted from its start.

Lines that are already shorter than the number are left alone, and empty lines stay empty. Spaces and punctuation count as characters, and the characters you keep are not changed.

Use it to make short previews of long lines, to take a fixed length code from the start of each row, or to trim a list to equal width.

Keep first characters of each line examples

Each example shows the number used. Spaces count as characters.

SettingBeforeAfter
Keep 7
I think I will buy the red car
I think
Keep 3
Hello world
Hel
Keep 5 (short line)
Hi
Hi
Keep 4 (spaces count)
a b c d e
a b 
Keep 1
apple
banana
a
b
Keep 10 (empty line stays)
Hello there friend

Ok
Hello ther

Ok

How to keep the first characters of each line

  1. 1
    Add your text
    Type or paste your lines into the box, or import a text file.
  2. 2
    Enter the number
    Type how many characters to keep from the start of each line.
  3. 3
    Click Keep First Characters
    Every line is cut to that length at once. Use Undo if you change your mind.
  4. 4
    Copy it
    Click Copy and paste the result where you need it.

When to keep the first characters

Good for

Making short previews of long lines, taking a fixed length prefix or code from each row, cutting titles to a limit and trimming a list to equal width.

Check first

Characters are counted from the start of each line, spaces included, so a number that ends in the middle of a word cuts the word. Use Undo right after if the result is not what you wanted.

Other tools

To keep the end of each line, try Keep Last Characters Of Each Line. To delete the start instead, try Remove First Characters Of Each Line.

Keep first characters of each line FAQ

What does the Keep First Characters Of Each Line tool do?

It keeps only the first characters of every line and removes the rest. If you enter 7, each line is cut to its first 7 characters.

How do I keep the first characters of each line?

Type or paste your text, enter the number of characters to keep and click Keep First Characters. The result replaces the text in the box. Click Copy to use it, or Undo to go back.

What if a line is shorter than the number?

It stays as it is. Only lines longer than the number are cut.

Are spaces counted as characters?

Yes. Spaces, punctuation and digits all count as characters, so I think I will with 7 keeps I think, which is 7 characters including the space.

Does it work on each line separately?

Yes. Every line is cut on its own, counting from the start of that line. Empty lines stay empty.

What number can I enter?

Any whole number from 1 upwards. If you enter 0, a negative number or a decimal, the tool asks for a valid number and does not change your text.

Does it count emoji and accented letters correctly?

Yes. Each visible character counts as one, so an emoji or a letter with an accent is not cut in half.

Is this tool free and is my text private?

Yes. It is free, needs no account and runs in your browser, so your text is not uploaded to a server.

Looking for more text tools?

Browse Modify Tools

Last updated: 28 October 2026