Unfair treatment in the workplace is the single largest driver of turnover in the tech industry, costing companies more than $16 billion per year in employee replacement costs, according to a first-of-its-kind study examining why people leave tech jobs.

The study, released last week from the Kapor Center for Social Impact and Harris Poll, surveyed a nationally representative sample of 2,006 US adults who left a job in a tech-related industry or function within the last three years.

Unfairness or mistreatment within the work environment was cited as the No. 1 reason for leaving a tech job by 37% of respondents. It was named more frequently than actively seeking a better opportunity (35%), dissatisfaction with the work environment (25%), being recruited away (22%), or dissatisfaction with their job duties/responsibilities (19%).

Overall, 78% of employees reported experiencing some form of unfair behavior or treatment, while 85% witnessed or observed unfair behavior or treatment in their previous workplace. And those working in the tech industry were more likely to leave due to unfairness than technical employees in other fields (42% vs. 32%).

SEE: Sexual harassment policy [download] (Tech Pro Research)

Underrepresented men of color were the most likely to leave due to unfairness (40%), while women of all backgrounds experienced and observed significantly more unfair treatment, overall, than men. Almost one-third of underrepresented women of color were passed over for promotions–more than any other group, the study found.

“Diversity in tech matters–for innovation, for product development, for profits, for meeting

future workforce demands, and for closing economic and wealth gaps,” the report stated. “But unfairness, in the form of everyday behavior (stereotyping, harassment, bullying, etc.) is a real and destructive part of the tech work environment, particularly affecting underrepresented groups and driving talent out the door.”

Unfairness-related turnover also hurts company reputations: 35% of former employees said their experiences would make them less likely to refer others to explore jobs with their former employer, and 25% said they would be less likely to recommend others to buy or use products and services from that employer.

Diversity and inclusion initiatives can improve company culture and reduce turnover, the report found–but only if they are done right. Some 62% of employees said they would have stayed if the company had taken steps to create a more positive, respectful work environment.

SEE: Does your company need a chief diversity officer?

The report offers companies three recommendations for addressing unfairness and retaining employees:

1. Implement comprehensive diversity and inclusion strategies

Companies should develop and implement a diversity and inclusion strategy that starts with the CEO and executive team. The strategy also needs to be comprehensive, focusing on multiple interconnected initiatives. “Treat diversity and inclusion as a business strategy: Try innovative approaches, measure the effectiveness of the strategies you implement, and course-correct when needed,” the report stated.

2. Create inclusive cultures

Companies should identify a set of core values, develop a code of conduct, and strive to continuously evaluate and improve the culture, the report stated. This means conducting employee surveys at regular intervals, examining data by each demographic group, providing transparency about issues with company culture, and addressing areas of concern.

“Collecting data is only the first step; companies must be willing to address the problems that are revealed by surveys and be prepared to discipline people who violate company values and drive talent away–regardless of their ability or seniority,” the report stated.

3. Develop effective and fair management processes

Companies should audit performance management and compensation practices for potential biases. They should also implement management training and bias-mitigating strategies in all stages of the employment lifecycle.

“With a concentrated focus on building inclusive workplace cultures, tech can save billions of dollars in financial and reputational costs, keep great talent, and finally make progress on its diversity numbers,” the report stated.