Source Code Line Counter
Count code, comment-only and blank lines in JavaScript and TypeScript files or a local project folder.
- Free
- Works Offline
- No Uploads
How to Count Lines of Code
- Open the HTML, review Security Check, then select Continue.
- Choose local files, use Choose Folder to retain project paths or select Open Sample.
- Review the directory filter and select Count Lines. The default excludes complete vendor and node_modules directory names, ignoring case.
- Read the totals. Choose a file name for its counts or the reason it was skipped. A line with code and comments counts as code, and whitespace-only lines count as blank.
- Download CSV to keep the full report and counting rules, including excluded or unsupported entries.
- Use UTF-8 source. One selection holds up to 5,000 files and 2 Mi UTF-16 code units of paths. The local scan allows 3 MiB and 1 Mi UTF-16 code units per file, 32 Mi UTF-16 code units across decoded source, and up to 30 seconds per scan.
- The parser reports syntax it cannot read. Only counted files contribute to totals. Identifiers beginning like spreadsheet formulas receive an apostrophe in the CSV.
Measure a Project by File
- Exclude vendor and node_modules directories by default, or include them before counting.
- Review totals and open a file to inspect its own counts or source diagnostic.
- Filter the visible rows by status and keep the complete selection in the report.
Formats and Compatibility
| Input | Choose a project folder to retain paths, or open individual files. Use this local count lines of code workflow for JavaScript, JSX, TypeScript and TSX. |
|---|---|
| Output | See separate totals for physical, code, comment-only and blank lines. Open a file row for its breakdown or the reason it was skipped. |
| Browser | A modern browser with local file support. |
| Scope | Measure source lines in a local JavaScript or TypeScript project and export the per-file counts. |
| Operating Systems |
Local Processing Without Uploads
This free browser-based tool performs local analysis with no upload. Use it to count lines of code without uploading files, or open the extracted HTML offline.
Select Open Sample to see the workflow with the included example.
Source Formats and Compatibility
Reads UTF-8 .js, .mjs, .cjs, .jsx, .ts, .mts, .cts and .tsx. It counts CRLF, LF, CR and Unicode line and paragraph separators. The browser’s folder picker supplies relative paths.
Keep a Record of the Counting Rules
The count lines of code tool exports every selected file in CSV, including excluded, unsupported and unreadable inputs. Each row includes the active directory filter and line rules.
Frequently Asked Questions
How do I count lines of code offline?
Choose the count lines of code download, extract the ZIP and open SourceCodeLineCounter.html in a compatible browser.
Can I count lines of code in browser?
Yes. Open the free count lines of code tool to count lines of code online with on-device processing. The ZIP also works offline.
Does the count lines of code browser tool run the files?
The tool reads and parses them as text. It leaves imports unresolved and preserves source files.
How are blank and mixed lines counted?
Whitespace-only lines are blank. If a line has code outside a comment, it counts as code. A final terminator adds no extra line.
Which directory paths does the filter recognize?
The folder picker retains project paths. The default filter matches complete vendor and node_modules directory names without regard to case. A file picked alone may provide only its name.
Does this tool work offline on Windows, macOS, Linux, and ChromeOS?
Yes. Local Studio tools run offline on Windows, macOS, Linux, and ChromeOS. Download the tool ZIP, extract it, and open the included HTML file in a supported browser. Your files are processed on your device without uploads.
Which browsers can I use with this offline tool?
Use a current version of Google Chrome, Microsoft Edge, Mozilla Firefox, or Safari where that browser is available for your operating system. Chrome is built into ChromeOS, and Safari is available on macOS.