Sometimes what matters isn't words or characters but simply how many lines a piece of text spans — poetry stanzas, code files, CSV rows. This tool counts the total number of lines in any text you provide.
A measurement with genuinely different meaning across different contexts
"Lines" mean something different depending on the kind of content being counted — in poetry, a line is a deliberate structural and rhythmic unit chosen by the poet, central to forms like the sonnet's strict fourteen-line structure; in programming, "lines of code" has long been used (with well-documented limitations) as a rough proxy for a codebase's size and complexity; and in structured data formats like CSV, each line typically represents one discrete record, making an accurate line count directly meaningful for understanding data volume.
How this tool counts lines
The tool counts the number of line breaks in your text (each newline character marking the end of one line and the start of the next), typically including or clearly noting how trailing empty lines at the very end of the text are handled, since this specific edge case can affect the final count by one depending on the counting convention used.
Where line counting is genuinely useful
- Reviewing code files and estimating complexity — while an imperfect metric on its own, lines of code remains a commonly referenced rough size indicator for source code files and diffs.
- Verifying CSV or structured data files — confirming a data export contains the expected number of records by counting lines, useful as a basic data integrity sanity check.
- Poetry and formal verse writing — confirming a poem meets a specific structural line-count requirement, like a sonnet's traditional fourteen lines or a haiku's three.
- Log file and text processing tasks — understanding the total volume of entries in a log file or other line-delimited text document.
Frequently asked questions
Does a blank line count as a line? Generally yes, in most counting conventions — an empty line still represents a line break in the underlying text structure, though some specific tools or contexts may choose to exclude genuinely blank lines from a "content lines" count depending on what's actually being measured.
Why is "lines of code" considered an imperfect measure of software complexity? Because the same functionality can be written in dramatically different numbers of lines depending on coding style, language verbosity, and formatting conventions — a genuinely well-documented limitation in software engineering research, which is why lines of code is generally treated as a rough size indicator rather than a precise measure of a codebase's actual complexity or quality.
How does line counting handle text copied from different operating systems? Different operating systems have historically used different line-ending character conventions (Windows traditionally uses a carriage-return-plus-newline pair, while Unix-based systems use just a newline), and a properly built line counter needs to correctly recognize both conventions to produce an accurate count regardless of the text's original source.
Further reading
Wikipedia — Source lines of code — The software metric and its well-documented limitations as a complexity measure.
Wikipedia — Newline — The different line-ending conventions across operating systems that affect line counting.