QSM Resources

Forty years of research – in one convenient place.

Code Counters

These links are offered as a convenient reference for code counting tools. QSM does not recommend or endorse any code counting tool and no warranty, express or implied, is offered as to the suitability of any tool for any purpose. Descriptions/features section comments are pared-down versions of descriptions from the tool provider. QSM makes no representation as to their accuracy or completeness and as the tools in this list are 3rd party applications, they are not included in our normal support.

If you have used, or are aware of, a code counting utility that is not mentioned below and would like to add it to the list, please click here to submit that information.

Become a QSM Code Counter Subject Matter Expert contact and receive a QSM white paper.

Code Counter Tool
Languages
Code Count
The CodeCount toolset spans multiple programming languages and utilizes one of two possible Source Lines of Code (SLOC) definitions, physical or logical. The CodeCount toolset is provided in source code only, and may be used as is, modified or further distributed subject to certain limitations. The tools in the collection are supplied in C source code only. You are responsible for compiling and building executable versions. The Instructions provide installation and execution directions.
Ada
ASP
ASP.NET
Bash Script
C Shell Script
C#
C/C++
ColdFusion
CSS
Fortran
HTML
Java
JavaScript
JSP
NeXtMidas
Perl
PhP
Python
SQL
VB
VbScript
XML
XMidas
 
Code Counter Pro
Counts several types of source code - including Java, C/C++, VB, PHP, HTML, Delphi/Pascal, and many more. New in v1.1! Create your own file types and comment types. Virtually unlimited file types supported. Easily define each file type's comment and count them all. Smart Comment feature - knows which comment types are used by each language and counts accordingly. (i.e. /* */ for C code and /* */ and // for C++ code. Save and load count profiles - no need to enter the same information over and over for the same source files to count. Sortable results grid - sort by total lines, total comments, total blank lines, total source code only lines, ascending or descending order. Export to CSV file or cut and paste into spreadsheet (i.e. Excel) for more detailed analysis. Free download, $25 US to buy.
Java
C/C++
VB
PHP
HTML,
Delphi/Pascal

File Types

asp,
asm,
bas,
bat,
c,
cob,
cpp,
c++,
cs,
css,
csv,
dfm,
f77,
f90,
frm,
h,
hpp,
htm,
html,
inc,
ini ,
java,
js,
jsp,
log,
pas,
php,
php3,
pli,
sql,
txt,
vb,
vbs,
xml,
and now... even your own file types!

 
CLOC
  • Exists as a single, self-contained file that requires minimal installation effort---just download the file and run it.
  • Can read language comment definitions from a file and thus potentially work with computer languages that do not yet exist.
  • Allows results from multiple runs to be summed together by language and by project.
  • Can produce results in a variety of formats: plain text, XML, YAML, comma separated values.
  • Can count code within compressed archives (tar balls, Zip files, Java .ear files).
  • Has numerous troubleshooting options.
  • Handles file and directory names with spaces and other unusual characters.
  • Has no dependencies outside the standard Perl distribution.
  • Runs on Linux, FreeBSD, NetBSD, Mac OS X, AIX, HP-UX, Solaris, IRIX, and z/OS systems that have Perl 5.6 or higher. The source version runs on Windows with either ActiveState Perl or cygwin. Alternatively on Windows one can run the Windows binary which has no dependencies.
 
Code Project
Complete source code line counter for Visual Studio .cs and .vb files. Has the ability to exclude blank lines, comments, Visual Studio auto-generated code, or designer files.
Visual Studio
 
EZ-Metrix™
With an easy Internet-based interface, multiple language support and flexible licensing features, you will be up and running in minutes with EZ-Metrix™. Measure source code size from virtually all text-based languages and from any platform or operating system with the same utility. Size data may be stored in EZ-Metrix's internal database or may be exported for further analysis. EZ-Metrix™ supports software development estimates, productivity measurement, schedule forecasting and quality analysis.

Internet-based
Easy to install and use

Supports multiple language
Provides a common measure for all languages with one tool

Ready to use today
No compilation or build required to use

View & export reports
Flexible reporting allows off-line analysis

Comparison measures
Better support for enhancements and maintenance activities

Configurable, rule-based algorithm
Supports language-level and project-level reporting

Flexible licensing
Only pay for what you need
Supports multiple languages
 
Java NCSS
  • Metrics can be applied to global-, class-, or function-level.
  • Counts Non Commenting Source Statements (NCSS), packages, classes, functions and inner classes.
  • Cyclomatic Complexity Number (McCabe metric)
  • Number of formal Javadoc comments per class and method.
  • Average values are calculated.
  • Command line driven.
  • A GUI is provided for better output browsing as well as the integration of JavaNCSS in a project manager and class browser named Jacob for easy selection of input source files.
  • XML output (optional).
  • XSLT stylesheets provided for further generation of HTML, and SVG reports and as a basis for your own custom reports.
  • Ant task (written by Steve Jernigan).
  • Support for Java 1.5 syntax (generics, enums, etc.).
  • 100% Pure Java.
  • Free software (GNU GPL).
Java
 
Line Counter
A program that counts the lines (source, comments, blank) in every file included in a MS VC++ 6.0 project. The program is able to count source code, comments (both styles: "// comment" and "/* comment */"), and blank lines.
Visual C++
 
LOC
The loc program provides the capability to count source and comment lines in multiple languages. Multiple files can be scanned, with recusion through subdirectories, and the grand total counts will also be given.
C/C++,
Fortran,
IDL,
Java,
Lisp,
Matlab/Octave,
Perl,
PHP,
Python,
SAS,
shell,
SQL,
Tcl/Expect.
 
LOCC
LOCC supports size measurement of grammar-based languages through integrated support for JavaCC. Comes with a prebuilt parser for Java, plus an experimental parser for C++. Can also measure the size of non-grammar-based languages (such as simple ASCII text.) Supports hierarchical size measurements. such as the number of packages, the number of classes in each package, the number of methods in each class, and the number of lines of code in each method. Given two files containing successive versions of Java source code, can perform a hierarchical "diff" of the two files, producing the number of new and changed packages, classes, methods, and lines of code within each method.
Java
 
LOC Metrics
LocMetrics counts total lines of code (LOC), blank lines of code (BLOC), comment lines of code (CLOC), lines with both code and comments (C&SLOC), logical source lines of code (SLOC-L), McCabe VG complexity (MVG), and number of comment words (CWORDS). Physical executable source lines of code (SLOC-P) is calculated as the total lines of source code minus blank lines and comment lines. Counts are calculated on a per file basis and accumulated for the entire project. LocMetrics also generates a comment word histogram.
C#,
C++,
Java,
SQL
 
Practiline Source Code Line Counter
  • Choice of folder and addition of files from the program without additional dialogues;
  • Simultaneous support of all format types;
  • Free selection of available formats; Definition of file format by its type (extension);
  • Advanced report export (printing, saving as pdf, doc and other formats, copying to clipboard);
  • Saving and loading of profiles for various users;
  • Displaying available profiles as menu;
  • Full report on the code:
    • number of source code lines
    • number of blank lines
    • number of comment lines
    • number of mixed lines (code and comments)
    • percentage of comments, blanks and source code
  • Sorting the report by any column of the table;
  • Copying a selected part of the report to clipboard;
  • Counting totals in the report (sum total, percentage).
C++,
JAVA,
PHP,
HTML,
XML
and many others
 
Project Line Counter
Supports Visual Studio .NET - dual VC6/VC7 add-in. Automatically scans workspace and project files.
Varied statistical data about your source code, including: lines of code and comment lines. Includes parsers for: C/C++, VB, INI and other file types.
Can filter statistics based on workspace or project files and/or custom wildcards.
Export as CSV file for processing by Microsoft Excel (includes sample worksheet with statistical analysis). Export as XML for use with the report stylesheets. Online help. Full source code.
VC++
Visual Studio.NET
 
Resource Standard Metrics
  • Determine source code LOC, SLOC, KSLOC for C, C++, Java and C#
  • Measure software metrics for each baseline and determine metrics differentials between baselines
  • Baseline code metrics are captured independent of metrics differentials so history is preserved
  • Report CMMI, ISO metrics for code compliance audit
  • Perform source code static anaysis, best used for code peer reviews
  • Remove tabs, convert from DOS to UNIX format, and pretty print code
  • Measure and analyze source code for out sourced or subcontacted code
  • Measure cyclomatic code complexity and analyze interface complexity for maintenance
C/C++,
Java
C
 
SLOC Count
Set of tools for counting physical Source Lines of Code (SLOC) in a large number of languages. SLOCCount runs on GNU/Linux, FreeBSD, Windows, and hopefully on other systems too. To run on Windows, you have to install Cygwin first to create a Unix-like environment for SLOCCount. SLOCCount is released under the General Public License (GPL).
Ada
Assembly
awk
Bourne shell and variants
C
C++
C shell
COBOL
C#
Expect
Fortran
Haskell
Java
lex/flex
LISP/Scheme
Makefile
Modula-3
Objective-C
Pascal
Perl
PHP
Python
Ruby
sed
SQL
TCL
Yacc/Bison
 
Toad®
Windows-Based PL/SQL development and Administration, includes code counter for ORACLE PL/SQL. Advanced editors allow users to work on multiple files simultaneously - even different file types such as SQL, PL/SQL, HTML, Java and text. Commercial product with free trial version available.
Oracle
SQL Server
DB2
MySQL
 
SLOC Metrics
SLOC Metrics measures the size of your source code based on the Physical Source Lines of Code metric recommended by the Software Engineering Institute at Carnegie Mellon University (CMU/SEI-92-TR-019). Specifically, the source lines that are included in the count are the lines that contain executable statements, declarations, and/or compiler directives. Comments, and blank lines are excluded from the count. When a line or statement contains more than one type, it is classified as the type with the highest precedence. The order of precedence for the types is: executable, declaration, compiler directive, comment and lastly, white space. Major highlights of SLOC are as follows:
  • Fast and efficient processing of source files
  • Process any size of file
  • Process any number of files (only limited by your system resources)
  • Flexible support for C/C++, C#, Java, HTML, Perl, Visual Basic and more. Ability to add definitions for other file types
  • Formatted and hyperlinked results in HTML file format
  • Formatted results in CSV (Comma Delimited) file format
  • Project folders and files are sorted by their Source Lines of Code so that you can easily identify code intensive modules and files
  • An easy to use, Windows-based graphical user interface.
  • Supports installation and un-installation
C/C++
C#
Java
HTML
Perl
Visual Basic
 
Understand
Reverse engineers, automatically documents and calculates code metrics; helps you understand, navigate and maintain source code. Each tool can parse and later manipulate very large amounts of code. (1,000,000 SLOC projects and above are common among our customers)
Ada,
C,
C++,
C#,
Java,
FORTRAN,
Delphi,
Jovial,
PL/M
VHDL