OnlineNotes Logo

    Line Counter

    Paste any text and see how many lines it has, how many are empty, and how long the longest one is. Counts update as you type.

    About this tool

    A line count answers practical questions: how many rows will this paste into a spreadsheet, how many records came back from that export, does this log match the expected number of entries. Filled lines are usually the number you want, since a blank line at the end or between sections is not a record.

    The longest line is useful when something has a line limit: code style rules, subtitles, CSV imports, or a text field that cuts off. To work with the lines instead of counting them, the tools below can remove duplicates, sort them or number them.

    How it works

    1. Paste or type your text into the box.
    2. Each line break starts a new line, so a wrapped line on screen still counts as one.
    3. A line with only spaces counts as empty.
    4. A single line break at the very end of the text does not add a line.

    Edge cases and limits

    • A line here means text between line breaks, not what you see on screen after wrapping. To count printed lines, the layout of the page would be needed.
    • A code editor counts a line break at the end of a file as one more line, so its total can be 1 higher.
    • Characters count each emoji and accented letter as one, which can differ from a byte count.

    Frequently asked questions

    How do I count lines in a text file?

    Open the file, copy all the text and paste it here. On Linux or macOS, the command wc -l counts line breaks instead, so it can differ by one.

    Does it count empty lines?

    Yes. Total lines includes them. "Lines with text" leaves them out, and "Empty lines" shows the difference.

    Why does my count differ from my editor?

    Most editors show an extra empty line after a final line break. This counter does not treat that as a line.

    Related tools