It's no secret that Khloé Kardashian is all about fitness, but there's a very important reason why the reality star is so dedicated to the gym. She recently revealed that the gym keeps her body looking right, but also helps her to keep her mind in check.

The "Keeping Up With the Kardashians" star told People she equates the cost of her gym membership with "buying your sanity." She told the magazine she thinks working out has an effect on her day-to-day attitude. Khloé, 31, shed nearly 40 pounds since she started working out and now she can't get enough.

"I definitely think the physical and the mental go hand in hand," she said. "I feel so good in the gym that it [affects] the rest of my day. It's a healthy addiction. It's like buying your sanity!"

Khloé Kardashian Khloé Kardashian, photographed at A+E Networks 2016 Winter TCAs in Pasadena, California, on Jan. 6, 2016, opens up about how working out and losing weight has affected her mental status. Photo: Getty Images

The reality star is so dedicated to the gym, in fact, that she's begun trying to involve members of her family in her fitness regime. Khloé recently said she's trying hard to get her younger brother, Rob Kardashian, to join her in working out, especially after his diabetes diagnosisE! News reported that she motivates her brother, who put on nearly 100 pounds after two back-to-back bad breakups, by reminding him that a revenge body is the best reason to get fit. Khloé said she jokes with Rob, 28, about making his "ex do a double-take."

Khloé also wrote a book about getting fit mentally and physically titled "Strong Looks Better Naked." In the book she talks, not only about her physical strength, but her mental strength — most of which she thanks estranged husband Lamar Odom for. According to E!, she thanked Odom, 36, in the book, writing that he gave her "some of the best years" and taught her how to be strong. Khloé went on to say that she "felt invisible" before they met and he changed all of that.