Count Lines of Code


How to Count Lines of Code in Visual Studio Code (VS Code)

When working on a growing project, it’s natural to wonder:

  • How big is my project?
  • How many lines of code do I have?
  • How much of that is actual code vs comments?

In this post, we’ll walk through a few simple ways to count lines of code using Visual Studio Code.

Method 1: Use VS Code Extensions (Recommended)

The easiest and most flexible approach is to install an extension.

Step 1: Open Extensions

  • Click the Extensions icon (left sidebar), or
  • Press Ctrl + Shift + X

Step 2: Search for:

“VSCode Counter” or “Code Counter”

A popular choice:

  • VSCode Counter (by Uriel Bitton)

Step 3: Install the Extension

Click Install.

Step 4: Run the Counter

  • Open your project folder in VS Code
  • Press Ctrl + Shift + P
  • Type:
Count lines in workspace
  • Select the command

What You’ll See

The extension will give you:

  • Total lines
  • Code lines
  • Comment lines
  • Blank lines
  • Breakdown by file type (HTML, Python, CSS, etc.)

This is extremely helpful for understanding the structure of your project.

Method 2: Use the Built-in File Explorer (Quick Estimate)

VS Code itself doesn’t natively count all lines across a project, but you can:

  • Open individual files
  • Look at the bottom status bar (line count for that file)

This works, but it’s manual and not practical for larger projects.

Method 3: Use a Terminal Command (Advanced)

If you’re comfortable with the terminal, you can use tools like:

Windows (PowerShell example)

Get-ChildItem -Recurse -Include *.py,*.html,*.css |
Get-Content |
Measure-Object -Line

Using cloc (Cross-platform, very powerful)

Install cloc, then run:

cloc .

This gives a detailed breakdown:

  • Lines of code
  • Comments
  • Blank lines
  • By language

Why This Matters

Counting lines of code isn’t just about size.

It helps you:

  • Understand project complexity
  • Track growth over time
  • Reflect on your work (great for portfolios)
  • Identify where most of your effort is going

For example, you might discover:

  • A lot of HTML (UI work)
  • Or a lot of Python (logic and backend)

Final Thoughts

If you’re using VS Code regularly, installing a counter extension is the simplest and most effective solution.

It takes less than a minute to set up—and gives you immediate insight into your project.

Tip: Try running it before and after a major feature—you’ll start to see how your project evolves over time.

Leave a Reply