Working from home has its perks, but being away from the structure and built-in social interaction of an office can take its toll.

More and more people are choosing to work from home either part time or full time. The U.S. Bureau of Labor Statistics reported that 22 percent of employed people worked from home at least some of the day in 2016.

And while the idea of sending emails from your kitchen table sans pants might sound appealing, it’s not a perfect setup. There are significant advantages and disadvantages to opting out of the office, particularly when it comes to your mental health.

Cara Maksimow, a licensed clinical social worker and therapist, told HuffPost many people choose to work from home in search of a better work-life balance, since remote working can “lessen some of the pressures that go along with going into an office every day.” Think: commuting, working under a manager’s supervision or attending meetings.

Ryan Hooper, a clinical psychologist practicing in Chicago, also believes “the flexibility and independence can be wonderfully freeing for some people.” Not only do you have fewer rules to abide by, you also have more autonomy over your time. You can schedule your hardest tasks during your peak productivity hours, take a two-hour lunch to recharge or attend a mid-morning yoga class.

Particularly if you feel restricted by your hours, commute or office environment, Hooper said, working from home can be a solution that reduces stress and adds more joy to your life.

Working from home can come at a cost.

This isn’t a blanket rule, though. For some people, working from home can put their mental health at risk, causing feelings of isolation and disconnection, Hooper noted. When you don’t have an office to show up to, you miss out on opportunities for regular social interaction and connection with co-workers.

“For some people, the feedback and encouragement loop of the work environment is critical to their jobs,” Hooper explained.

On top of the isolation, working from home can also make it difficult to set boundaries.

“It can be really helpful to get some household chores done in the middle of the workday, like switching laundry or picking up a child from school,” Maksimow said, “but the lines between work and home can blur and make it hard to ‘turn it off.’” As a result, you might find yourself logging more work hours, some of which might cut into your family time or affect your sleep schedule.

You might also experience increased anxiety or stress, since “working remotely creates a unique pressure to appear busy,” said Jane Scudder, a certified personal development and career transition coach. Because you’re not present in an office, she explained, you may feel pressure to be online every hour, make yourself constantly available or otherwise prove you’re spending your time in a productive way.

To make matters trickier, people who work from home might feel a sense of guilt about their work arrangement, Scudder explained. This guilt, coupled with the anxiety that comes from needing to prove yourself, can make remote workers question their worth, she said.

Hero Images via Getty Images

How do you know if working from home is right for you?

How you respond to a home work environment depends on a handful of different factors, like your living situation, health, personality, work culture, habits and daily job duties.

If you’re considering either working from home for the first time or transitioning back to an office environment, Scudder said it’s important to ask: “What do you need to be a functioning, fulfilled human and worker?” Do you crave independence and space to work, she said, or do you prefer to engage with people on a regular basis?

“I would encourage you to take an honest survey of your work habits and tendencies,” Hooper added. “Being a self-starter, maintaining good organization and being a great communicator are all important for working from home,” he explained.

It’s especially important to consider your mental health history when making the decision. If you struggle with depression, for example, working from home has the potential to exacerbate feelings of isolation and perpetuate inactivity.

“My inclination would be that working in a supportive work culture would be more beneficial to someone struggling with anxiety or depression than working from home,” Hooper said. Research suggests behavioral activation for depression (in other words, engaging in activities outside of the house) and overcoming avoidance for anxiety (exposing yourself to activities you fear) help people manage the conditions, he added.

Of course, it can also work the opposite way. “There may be situations where the commute becomes a trigger for anxiety or depression, or the work environment is toxic [due to] peer conflict or harassment,” said Maksimow, in which case working from home can be a relief and comfort.

There’s no perfect formula for figuring out whether or not working from home works for you. How you’ll respond to a remote work environment is completely dependent on your individual needs and triggers, Maksimow explained. If you feel unhappy in your current work situation — whether it’s at home or in an office — and are unsure what to do, consider talking to a mental health counselor to help you weigh your options.

And if you do decide to work from home, these tips can help you stay healthy and happy:

1. Establish a work zone

Setting up a dedicated workspace at home is crucial to your productivity and focus, Scudder said, even if it’s just a space at the kitchen table or a small desk in a corner of your living room. “Either way, have a workspace that you can go to for work and that you can leave or walk away from after the work day is done,” she explained.

2. Stick to a schedule

Following a schedule is key when you’re working from home, said Hooper. “Otherwise, it can be easy to procrastinate or over-schedule yourself away from your job duties,” he explained.

In addition to setting clearly defined work hours, Scudder also recommended waking up at a regular time each day, showering and getting dressed. “That doesn’t mean you have to get dolled up to work from your home office, but do have a routine that you keep,” she said.

3. Practice self-care

Maksimow recommended carving out time each day for exercise, meditation or other self-care practices. That includes leaving the house for social activities, she said, and making time for rest and relaxation. “Disconnection from work is an important component to feeling refreshed and motivated,” she explained.