Class attributes are variables defined within a class but outside of any instance methods, shared across all instances of the class. They are useful for storing data that should be consistent across all instances, such as constants or default values, and can be accessed using the class name or an instance of the class.