FORTUNE -- Etsy had a woman problem.
Not among customers -- it would probably surprise no one that women made most of the $895 million in purchases on the site in 2012, or that fully three quarters of the 800,000 handmade and vintage merchandise shops hosted online by Etsy are woman-owned. But as Marc Hedlund found out when he joined the Brooklyn-based technology company as head of engineering a year ago, just three of his then 100-person team was female. And while the dearth of female engineers is a frequent source of headshaking in the tech industry, Hedlund believed it was a fundamental problem that Etsy, which caters so completely to women, wasn’t being built by them in any significant way.
“I spoke at an Etsy seller symposium when I started here, and in a room of 150 people, it was all women -- and me,” Hedlund recalls. “Then I went back to the area where I work and … wow.” So at an all-hands meeting with his department last January, Hedlund displayed a graph showing the number of female checkouts on the site (nearly all of them) compared with the number of women in his department (almost none of them), then asked his team of software problem solvers a question: “Can we fix that?”
Change the ratio conversations in tech often get mired in debates over where the gender imbalance originates. Are women less interested in pursuing careers in the STEM (science, technology, engineering and math) fields? Are they somehow less able? Are there systematic roadblocks to their participation?
For his part, Hedlund observes that “retrofitting a woman or minority population is like trying to retrofit unit testing,” referencing the practice employed by software engineers of testing individual segments of code as they are deployed, so that bugs are identified before new generations of code are built on the faulty sections, causing even greater problems. Without unit testing, programmers know that it’s painfully difficult -- if not impossible -- to sort out where software problems originate. There are simply too many variables to consider. So when faced with a buggy gender ratio in their department, so to speak, Hedlund says he and his team recognized that as fascinating as a philosophical conversation about its origins may be, they would likely never know where or why the imbalance originated. But like all good hackers, they were determined to get the current system working the way they want it to. “And of 100 people in the room,” says Hedlund, “I’m very proud to say that not one of them said we should do it by lowering our standards, which is what often comes up in these sorts of conversations when I’ve raised the issue elsewhere.”
So how does a company go about building a more gender-balanced engineering department? First, wondering whether their recruiting methods were faulty, Hedlund tweaked his search methods, under the assumption that if standard recruiting located primarily male candidates, it would take unusual techniques to identify female engineering prospects. He pored through code-sharing site Github for female developers sharing interesting programming projects, and monitored link-sharing site Delicious for women who bookmarked articles about programming to their profiles, or who made smart comments on programming topics that he was following. “I searched Twitter for people who tweet about installing and hacking interesting code,” Hedlund says, adding that he met one female candidate after a friend retweeted her programming joke. Programming jokes are tough to make, and “hers was really funny,” he says. Hedlund invited the woman to interview at Etsy, and she was hired last spring. While individual efforts like these were important for expanding his own horizons, Hedlund acknowledged that they only work if women self-identify as female on social networks, and women programmers shy away from calling attention to their gender, so they don’t.
Next, the department took a hard look at its interviewing process. “One of the things the Googles and the Facebooks of the world do is have someone go up to a whiteboard and write a program in front of the interview panel,” says Hedlund. The practice has become standard at engineering departments across the tech industry, Etsy included, but Hedlund’s team questioned whether it served the intended purpose of finding the best programming talent. “The fact is, we don’t hire people to code on whiteboards,” he says. “That’s more about performance art -- and it’s confrontational. Conceivably, it’s also gender-biased.” Beginning in June, the company scrapped whiteboard challenges in favor of pairing candidates with existing Etsy engineers to work on actual programming tasks for the company. The goal: to make introverted candidates feel more relaxed, have them work in a real programming environment, and see whether they can collaborate well with existing staff.
The changes yielded results. “We hire about one engineer a week, and half of the people hired since we started making changes are women,” he says. By early summer Etsy had 11 female engineers, up from the original three.
The final piece of the puzzle dropped into place when Hedlund announced in April that Etsy would team with Hacker School, a group that hosts three-month immersive sessions in New York City billed as “writer’s retreats for programmers,” where students can pursue personal passion projects, contribute to open source coding efforts and learn by interacting with fellow students and high-profile guest speakers from the industry in a minimally structured environment. Hacker School is free to accepted students (the group funds itself with commissions on any job placements that they broker for graduates at the end of each session; alumni have gone on to work at Tumblr, Betaworks, PhotoShelter and others), though they give up their jobs to attend and have to pay their own expenses. Etsy offered up two rooms at its headquarters for students to work in, enough to double Hacker School’s previous class size to 40 students, and pledged ten $5,000 grants to support female attendees, if Hacker School committed to ensuring a balanced gender ratio -- no small task, given that fewer than 5% of all prior applicants and just two graduates of the program up to this point were women.
For Hacker School co-founder Nicholas Bergson-Shilcock, it was a challenge he welcomed. The program was founded “to design the programmer community that we wish we had,” as he puts it. His vision is one of a more collaborative industry -- and a workforce more reflective of society’s demographics, whether that means balanced gender ratios or more racial diversity -- so contrary to what one might expect for an immersive computer programming school, its key tenets aren’t technical, they’re social.
All attendees must agree to Hacker School’s four rules: First, “no feigning surprise,” as when one person comments to another, “Really? You didn’t know that?” (Bergson-Shilcock describes the practice as an ego-driven tendency that programmers sometimes indulge when showing off to colleagues.) Second, there’s no “well, actually-ing” allowed -- otherwise known as nitpicking on aspects of a colleague’s conversation, again as a way to demonstrate one’s own superior knowledge. Third, “no backseat driving.” Hacker School requires that students participate fully in conversations or collaborations -- no lobbing comments from across the room if you aren’t fully invested in the outcome. And lastly, an additional rule that was new with this summer’s batch: “No subtle expressions of racism or sexism.” The rules require that if students observe any of these behaviors, they respectfully point them out and discuss them to resolve differences with their fellow hackers.
Bergson-Shilcock and his partners developed the rules when they founded Hacker School because, he explains, “there are social rules all around us, but they’re mostly implicit. We try to make them explicit, because when you make it explicit you can talk about it.” Removing unspoken social restraints increases student confidence, he adds, which opens the doors to learning. “One of the biggest barriers to people actually learning is fear of embarrassment,” he says. “We think our environment is more female-friendly not because it’s intended to be female-friendly, but because it’s human-friendly.”
Once word of the Etsy-Hacker School partnership spread, Bergson-Shilcock received 661 applicants from female candidates (they received a total of 130 applicants for the previous batch). And instead of fielding a class of 20 women among 40 students, Etsy and Hacker School hosted 23 women this summer in a batch of 51. When 18 of those women requested grants -- eight more than Hedlund had budgeted for funding, he reached out to colleagues at Yammer and 37Signals, which each pledged four grants so that every woman seeking a grant received one. The amount for each grant was also increased, to $7,000 per recipient.
Sunah Suh, a former QA engineer with Riverbed Technology, recalls a 1:10 ratio in her college computer science department, and was the first woman engineer hired at her previous job. “I never realized how much it mattered until Hacker School,” she says. “There were some ineffable, intangible qualities about being in a room that’s gender balanced -- you feel more comfortable in your own skin. In tech, there’s this sort of uniform of jeans and a t-shirt. I had this moment when I realized I wouldn’t get any unwanted attention if I wore something different, a summer dress or something. It sounds silly, but extrapolate that to every other interaction you have as an engineer -- I didn’t even realize how much I censored myself in certain situations, until I didn’t do it anymore.”
Martha Girdler, previously a front-end developer -- and formerly the only female engineer -- at Internet humor publisher Cheezburger, agrees. “You don’t want to act like an idiot in front of these people you respect and work with,” she says. “All the men I worked with, I admired them so much, what they did and what they built -- but I didn’t have the confidence to ask questions or admit when I didn’t know something, so I didn’t learn as quickly.” Because of the social rules, Girdler says, “Hacker School cured me of that fear. I’ve become both more collaborative and more self-reliant, because now I have confidence.” Girdler says she has more tools for finding things herself online, and is now comfortable asking others for help when she isn’t able to find the answer on her own. Both Girdler and Suh were hired by Etsy, which snapped up five women and three men from the summer Hacker School session. Hedlund says he may yet “hire at least one or two more.”
That brings the ratio at Etsy’s engineering and operations team to nearly 14% female, with 22 women engineers now on his staff of 165 -- a startling transformation to make in less than one year. Etsy invited Hacker School to stay in its Brooklyn digs for its fall batch, so the company will have another 50 students -- 18 of them women -- to recruit from before year’s end. (The company again handed out grants to female attendees, with GitHub and Palantir also contributing funding for female hackers to attend.)
For Hedlund and his engineering team, hacking their recruiting methods this year has been perhaps their most important project. And he was right: In the end, it didn’t matter where the bug originated or who wrote the faulty script. What matters is that now, Etsy’s homemade system for making more women engineers is working exactly right.
A shorter version of this story appeared in the February 25, 2013 issue of Fortune.