When Dan Ryan worked at accounting firm Belfint, Lyons & Shuman as a 21-year-old intern, he loved the days when he could wear shorts and flip flops, or a superhero T-shirt and jeans to the office in Delaware in the US.

He also enjoyed the office putt-putt golf and was surprised to learn that the firm organised wine and painting parties, cup-stacking tournaments and other fun events.

No one was running around like their hair was on fire.

So it was a “no-brainer” for him to accept a full-time offer with the firm as a staff accountant after graduation in 2014. “It was such a relaxed culture where I could have fun and socialise with (colleagues) — definitely not what I expected,” he said. “No one was running around like their hair was on fire, which was what I imagined public accounting would be like.”

The “work hard, play hard” culture is a magnet for millennials like Ryan who want—and sometimes expect—their job to be an enjoyable social experience. “We have a commitment to make work as fun and stress-free as possible, which helps keep production high,” said LeAnne Diebold, Belfint’s administrator. “Our staff knows after working hard, especially during tax season, that there will be something fun just around the corner.”

Google — with its scooters, slides and ball pits — is perhaps best known for trying hard to combine work and fun, and it consistently ranks as the most popular employer of millennials around the globe.

These days, more companies of all stripes are making fun part of their culture. They hope to engage and energise all of their employees, but are especially focused on attracting and retaining millennials, who were born during the 1980s and 1990s and are now the largest generation at many companies.

Belfint posts photos of its office high-jinks on Facebook, where they’re most likely to reach potential young recruits. “Millennials have much more of a desire for a family environment, where they can have fun and make friends, than the baby boomers did,” Diebold said. “Boomers worked hard and then went home; they were driven by their personal goals.”

Fun is even becoming part of the value and mission statements of some companies. SMA Solar Technology in Germany says on its website that, “Work should be fun” is one of the maxims of our board of directors,” while Warby Parker, a US marketer of glasses, says having fun is one of its “ground rules.”

But every company’s definition of fun varies. At SMA, fun means more flexible work hours, a fitness centre, and summer and Christmas parties. In contrast, online retailer Zappos, which has long declared, “Create fun and a little weirdness,” to be a core value, keeps its staff entertained with a host of activities, including talent shows, karaoke and pajama days.

Hays, a London-based recruitment firm, released a global study of millennials in 2014 that found “fun and social interaction” to be especially high on their workplace priorities list. About 60% of the respondents in the Netherlands cited it as one of the chief reasons for choosing an employer, as did 52% in Japan, 45% in Germany and 33% in the US.

More than just activities

But organising a few fun activities in an otherwise rigid, authoritarian workplace is probably misguided and won’t do much to motivate employees and attract millennials. “The culture needs to be harmonious with a sense of playfulness so that there’s authenticity,” said Robert Potter, group human resources director at Hays. “Play fits technology companies like Google where innovation and creativity are part of the culture, but there’s no room for bouncing up and down on balls in a high pressure sales environment.”

These days, there are even consultants advising companies on making work more fun.

Nick Gianoulis, founder of the Fun Dept and co-author of the book, Playing it Forward, recommends that companies think of fun not as an isolated event like an annual picnic or holiday party, but rather as “a process that goes on all year long and becomes a natural part of the business.”

Any benefit from a once-a-year party is fleeting, he added. “It could even have a negative effect on some people who don’t like giving up their personal time for an evening or weekend celebration.”

He also advises employers to limit the levity to as little as 10 or 15 minutes, and to survey employees about what they would enjoy. The last thing companies want to do is make workers feel uncomfortable because they don’t want to join in the so-called fun.

Workplace Dynamics, a software and employee survey company in Pennsylvania, also believes variety is essential. “When you do things as a routine, they lose their luster; unexpected surprises are much better,” said Dan Kessler, president of Workplace Dynamics, which has brought tricycle races and water balloon games to its office. The company founder and CEO even agreed to sit in a dunk tank when employees hit a quarterly financial target.

Some companies find that employees who leave for other jobs often boomerang back because they miss the office antics. “We frequently have people return because they felt like they were just a number at the other company,” said Peggy Eddens, executive vice president and chief human capital officer, at WSFS Bank in Delaware. “They like all the socialising,” whether it’s drinking at an after-work happy hour in the lobby, decorating cupcakes, golfing blindfolded, posting silly selfies on the company’s intranet, or winning a small prize answering trivia questions.

To spread its ethos to other potential recruits, the bank even created a YouTube video of employees wearing silly hats, tossing money in the air, dancing and clapping to Pharrell Williams’s hit song “Happy.”

Does fun hurt productivity?

But do employees at companies with happy cultures get any work done? A study of staff at a US restaurant chain found that manager support for having fun on the job reduced the turnover rate but employees’ performance suffered.

Most employers, however, claim fun and games boost both retention and performance. “Taking a break to play and laugh definitely renews people’s energy,” Eddens said. “Levity also helps bridge generation gaps. It’s great to see a 25-year-old and a 60-year-old laughing and playing bean bag toss together; sometimes the CEO even joins in.”

Indeed, baby boomers may not be such party poopers after all. Professors at San Francisco State University studied generational attitudes toward playtime in the workplace, and contrary to their hypothesis, found that baby boomers didn’t regard it as frivolous or a drag on productivity. “Boomers, with a reputation of ‘achievers at any cost’….may in fact not only benefit from workplace fun, but may be supportive,” the study concluded.

To comment on this story or anything else you have seen on BBC Capital, please head over to our Facebook page or message us on Twitter.