Jessica Guynn, USA TODAY

SAN FRANCISCO — Toxic workplaces — where harassment, stereotyping and bullying occur — are driving away women and people of color, undercutting technology companies' efforts to increase diversity and costing an estimated $16 billion a year.

That's the conclusion of a first-of-its-kind study from the Kapor Center for Social Impact and Harris Poll that explored the reasons people leave tech companies.

"The study is an important first step in understanding how turnover and workplace culture contribute to the lack of diversity we are seeing in the tech industry," Dr. Allison Scott, the study's author and chief research officer at the Kapor Center, told USA TODAY in an interview.

All major tech companies track retention data, but they do not make it public. There's been an outpouring of first-hand accounts of sexual harassment, gender discrimination, bullying and racial bias on blogs, social media and in lawsuits. These strongly suggest high rates of turnover among the very groups companies are struggling to keep as they try to change the demographics of their mostly white and Asian male staffs.

Related:

An Uber engineer kills himself. His widow says the workplace is to blame.

Stereotyping, missed promotions

According to the "Tech Leavers" study, nearly eight in 10 employees who left tech jobs reported experiencing some form of unfair behavior or treatment, while 85% observed it. And 37% said they left their jobs because of it.

In fact, unfair behavior and treatment was the No. 1 reason given for leaving, and was twice as likely to be cited than being recruited for a better opportunity.

Other findings:

-Women experienced and observed far more unfairness than men.

-Nearly one-quarter of underrepresented men and women of color experienced stereotyping, twice the rate of white and Asian men and women.

-Nearly one-third of underrepresented women of color were passed over for promotion, more than any other group.

-LGBT employees were the most likely to be bullied (20%) and experience public humiliation (24%) and 64% said it contributed to their decision to leave.

-Men from underrepresented groups, such as African Americans, Latinos and Native Americans, were most likely to leave due to unfairness (40%).

-Underrepresented women of color were significantly more likely to cite unfairness as a reason for leaving than white and Asian women (36% versus 28%).

-Nearly a quarter of underrepresented men and women experienced stereotyping in their previous job and at almost twice the rate of white and Asian men and women.

-Employees in tech companies were significantly more likely to leave due to unfairness than technical employees in other industries (42% versus 32%).

Ellen Pao, who brought an unsuccessful gender discrimination lawsuit against one of Silicon Valley's most powerful venture capital firms, triggering a national debate on the treatment of women, says everyone knew this sense of unfairness was prevalent in tech — particularly with regard to women and underrepresented people of color.

"Now we have the data to understand the scale of these issues," said Pao, now chief diversity and inclusion officer at the Kapor Center for Social Impact and a venture partner at Kapor Capital.

Nationally representative sample

The study reinforces earlier findings that the tech industry is like a sieve for underrepresented groups. One study found that women in tech leave their jobs at twice the rate of men. Another found that after about 12 years, about half of women had left their jobs in STEM fields, mostly in computing or engineering. Previous studies mostly focused on the experiences of women in the industry. The Kapor study is one of the first to turn its attention to a nationally representative sample of all groups, including groups that are underrepresented in tech such as women, African Americans and Hispanics.

Diversity experts say the percentage of each demographic group that remains with a company each year could be the most telling data with which to gauge how inclusive a workplace is. Retention rates naturally vary year to year but should not vary greatly across demographic groups, they say. In the study, why underrepresented groups left their jobs "is where we see differences," Dr. Scott said. "All groups left due to unfairness but for different types of unfairness."

Former Uber software engineer Susan Fowler, who made explosive allegations of sexism and harassment at the ride-hailing company in a post on her personal blog that led to an internal investigation, said her request to transfer to another team to avoid her harasser was rejected because of retention concerns.

"It turned out that keeping me on the team made my manager look good, and I overheard him boasting to the rest of the team that even though the rest of the teams were losing their women engineers left and right, he still had some on his team," wrote Fowler who left Uber in December.

So Fowler calculated the retention rate for her department. She says it had slipped from being about a quarter female to 6% in a year. "Women were transferring out of the organization, and those who couldn't transfer were quitting or preparing to quit," she said.

$16 billion cost

According to the Kapor Center, a black man responded to the survey that he observed several people being passed over for salary raises and promotions because they didn't fall in line with the "jock culture." "Gross generalizations were made of groups of people," he wrote. "I was offended by the liberal use of stereotypes and the insistence on making a 'welcoming culture' that truly focused on only improving work life for a single demographic.”

Women, African Americans and Hispanics are underrepresented in all occupations within the tech sector when compared to the U.S. population and the private sector as a whole. Among the top-grossing tech companies such as Apple, Facebook and Google, black and Latino employees combined represent 3% to 5% of employees, numbers that have not budged in three years, Kapor Center found.

Since first going public with their diversity problem in 2014, tech companies have spent hundreds of millions on diversity initiatives, many of which focus on recruitment, hiring and programs such as unconscious bias training.

The tech industry frequently blames the "pipeline" for not delivering enough qualified candidates from underrepresented backgrounds. But Kapor Center co-chair Freada Kapor Klein says the more nuanced and accurate way to frame the issue is to look at the complex set of biases and barriers that begin in preschool and persist in the workplace that have kept women and people of color from gaining access to some of the nation's highest-paying jobs in one of its most sought after economic sectors.

She believes how those underrepresented groups are treated once inside these companies goes a long way toward explaining why tech companies can't get their diversity numbers to budge.

Intel is outside the norm

Intel is one of the only tech companies to release its retention data. Retention became a key focus after the tech giant realized underrepresented groups were leaving at higher rates. In February, Intel said it had reduced those rates, achieving a 15% exit rate for women and people of color compared to a 15.5% exit rate for white and Asian men and women.

The semiconductor giant had plenty of incentive to focus on retention, according to the Kapor study.

The industry is shelling out an estimated $16 billion a year to replace employees who leave as a result of unfair treatment. Individual tech companies are also taking an incalculable hit to their corporate reputations, the study found. More than a third of disaffected employees in the study said their experiences would make them less likely to refer others to seek jobs at their former employers and a quarter said they would be less likely to recommend others buy or use products from their former employer.

Perez is now chief product officer at HealthSherpa, where she says she can bring her "authentic self" to work. She says she and fellow executives think of and treat new employees as co-founders. If she tells the CEO about a feminist book she's reading, he pops it into his Amazon cart. The 20-person start-up, funded by Kapor Capital, has taken the venture capital firm's pledge to boost diversity and is creating diversity and inclusion initiatives.

Retention is a metric that HealthSherpa has consciously started to track, Perez says. If tech companies don't pay attention to it, "you are literally sacrificing pure talent and you are impacting your bottom line."

The good news: Improving work culture and adopting a comprehensive diversity and inclusion strategy can reduce attrition. Nearly two-thirds of employees who left tech said they would have stayed if their employer had fixed its culture.

"Tech has a huge problem with a culture of disrespect," Klein says, "that plays out differently based on different demographics."

"What that means," she says, "it can be changed."

Follow USA TODAY senior technology writer Jessica Guynn @jguynn

Read more USA TODAY coverage of inclusion and diversity