Need help with gcovr?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

551 Stars 211 Forks Other 712 Commits 59 Opened issues


generate code coverage reports with gcc/gcov

Services available


Need anything else?

Contributors list


generate GCC code coverage reports

website_ • documentation_ • bugtracker_ •


|GitHub-Actions-badge| |pypi-badge| |codecov-badge| |gitter-badge|

.. begin abstract

Gcovr provides a utility for managing the use of the GNU gcov_ utility and generating summarized code coverage results. This command is inspired by the Python coverage.py_ package, which provides a similar utility for Python.


command can produce different kinds of coverage reports:
  • default or :option:
    : compact human-readable summaries
  • :option:
    : HTML summaries
  • :option:
    : HTML report with annotated source files
  • :option:
    : machine readable XML reports in Cobertura_ format
  • :option:
    : machine readable XML reports in Sonarqube format
  • :option:
    : JSON report with source files structure and coverage
  • :option:
    : JSON summary coverage report
  • :option:
    : CSV report summarizing the coverage of each file
  • :option:
    : machine readable JSON reports in Coveralls_ format

Thus, gcovr can be viewed as a command-line alternative to the lcov_ utility, which runs gcov and generates an HTML-formatted report. The development of gcovr was motivated by the need for text summaries and XML reports.

.. _gcov: .. .. _cobertura: .. _lcov: .. _coveralls:

.. end abstract

Example HTML summary:

.. image:: ./doc/images/screenshot-html.png

Example HTML details:

.. image:: ./doc/images/screenshot-html-details.example.cpp.png

.. begin links

.. _website: .. _documentation: .. _repo: .. _bugtracker: .. |GitHub-Actions-badge| image:: :target: :alt: GitHub Actions build status .. |pypi-badge| image:: :target: :alt: install from PyPI .. |codecov-badge| image:: :target: :alt: Codecov status .. |gitter-badge| image:: :target: :alt: Gitter chat

.. end links


.. begin installation

Gcovr is available as a Python package that can be installed via pip_.

.. _pip:

Install newest stable

release from PyPI:

.. code:: bash

pip install gcovr

Install development version from GitHub:

.. code:: bash

pip install git+

.. end installation


.. begin quickstart

GCC can instrument the executables to emit coverage data. You need to recompile your code with the following flags:


--coverage -g -O0

Next, run your test suite. This will generate raw coverage files.

Finally, invoke gcovr. This will print a tabular report on the console.


gcovr -r .

You can also generate detailed HTML reports:


gcovr -r . --html --html-details -o coverage.html

Gcovr will create one HTML report per source file next to the coverage.html summary.

You should run gcovr from the build directory. The

option should point to the root of your project. This only matters if you have a separate build directory.

For complete documentation, read the


.. end quickstart


If you want to report a bug or contribute to gcovr development, please read our contributing guidelines first:



.. begin license

Copyright 2013-2021 the gcovr authors

Copyright 2013 Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain rights in this software.

Gcovr is available under the 3-clause BSD License. See LICENSE.txt for full details. See AUTHORS.txt for the full list of contributors.

Gcovr development moved to this repository in September, 2013 from Sandia National Laboratories.

.. end license

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.