Why do cats knead?

Cats knead for a variety of reasons, including instinctual behavior from their early kittenhood. Kneading, also known as "making biscuits," is a behavior in which cats rhythmically push and pull their paws against a soft surface.
One theory suggests that kittens knead to stimulate the milk flow from their mother's mammary glands while nursing. As they grow up, cats may continue to knead as a way to find comfort and relaxation, as the motion and pressure of kneading can release endorphins, which make them feel good.
Kneading can also be a sign of affection, as cats often knead their owners or other cats they are close to as a way of showing love and trust. Some cats may also knead as a way to mark their territory, as the scent glands on their paws can leave a scent that marks a familiar place as their own.
Overall, kneading is a natural behavior for cats that can be a sign of comfort, affection, or territorial marking.