Class inheritance is a fundamental principle in object-oriented programming that allows a new class, known as a subclass, to inherit attributes and methods from an existing class, known as a superclass. This mechanism promotes code reuse and establishes a hierarchical relationship between classes, facilitating polymorphism and encapsulation.