It feels horrible at the time, but research suggests that going through this crisis is extremely valuable as we age. Folks in their 40s and 50s have higher stress levels than their younger counterparts, but they don’t jump into crisis mode. Why? Because those coping mechanisms that they developed as young adults have continued to strengthen. The pains of being a 20-something may feel terrible when you’re in the middle of it, but it improves our lives in the future.

The “quarter-life” crisis experienced by many 20- and 30-somethings typically involves four stages: 1. Being locked into a commitment (relationship, job, housing, etc.) 2. Ending that commitment, and now feeling isolated 3. Internal reflection, followed by exploring new interests 4. Emerging from the crisis much happier and with a greater sense of purpose

As you get older, it can be tough to remember what being in your twenties was really like. Not how it looks in your employees’ carefree Instagram photos or your own old photo albums (remember those?), but how it really felt in the moment.

Namely, being in your twenties is often confusing and lonely, as two independent studies published this year found. When young adults get their first jobs and move into their own apartments, they’re going it alone, usually for the first time. Moreover, as they attempt to establish their status as adults, their environment sends them mixed messages: regardless of their professional or personal achievements, they are still considered by others to be “kids,” especially before they marry and have children.

This prolonged interim state results in a lot of pain, and some studies suggest today’s young people are suffering more than previous generations did. For instance, the average age for the onset of depression has dropped from late forties or early fifties, where it was 30 years ago, to mid twenties, and it’s expected to drop further. Psychologists aren’t entirely sure why; it’s likely due to a mix of factors.

Regardless of the cause, the quarter-life crisis often spans several years and includes four typical stages. It starts with a feeling of being locked in to a commitment at work or at home: people take on jobs, rent apartments, and enter relationships, but then feel trapped in pretend adulthood. Then, at some point, they leave their romantic partners, jobs, or social groups and become separated and lonely. They spend the worst part of this crisis reflecting and recalibrating their plans, alone and isolated, until eventually they go out and explore new hobbies, interests, and social groups, finally emerging at the other side of the crisis happier, more motivated, and with a greater sense of clarity. This process can last for years, or repeat itself. It is a painful process, but it is also a tremendous growth opportunity, as it can create individuals who go on to lead more meaningful and happier lives.

At Happify, our data science team looked at various psychological indicators of some 88,000 people who joined our service during 2015. We found evidence both for the prominence of the quarter-life crisis and for the rise in well-being that follows it. Looking first at self-reports of ongoing stress, we found that people experience a sharp increase in stress levels in their late twenties and early thirties. Stress levels increase more moderately during the thirties and forties, remain steady for about 20 years, and then drop sharply as retirement comes around.

Yet even though the intake of stress continues to rise into the thirties and forties, the person’s emotional response to it declines. Most people start to experience an increase in positive emotions as early as their late thirties, and a few years later also experience a significant improvement in overall satisfaction with life. This positive process starts after the quarter-life crisis and continues as people find new ways to deal with interpersonal, work, and family stressors. One’s late twenties and early thirties, from an emotional perspective, are therefore the worst part of life. It’s during these years that people experience the most negative thoughts and feelings and experience the most mind wandering, a psychological state that has been shown to be detrimental to well-being.

The change that occurs after the quarter-life crisis is attributable to a set of skills we acquire: we learn to develop psychological mastery and to regulate and attenuate our emotions, or to dismiss them instead of dwelling and allowing emotions to take over. As we age, we learn to put things in perspective, believe in ourselves more, and realize that the emotions that sometimes pierce our chests are temporary and do not have to consume us. Psychological aging is a positive process in which older equals better. That should reassure twentysomethings who are currently feeling stressed out or lost, and help their elders remember what it was like — really like — to be young.