Silicon Valley has a gender problem, and some big-name companies are finally trying to change things by addressing the problem where it starts: with kids. Firms like Google, Square, and Codecademy are showing young girls that it's cool to code, hoping it will eventually boost the number of women who fill tech jobs across the Valley and beyond.

Even as it works to help bootstrap female techies in other ways, Google recently announced the Made to Code campaign. The company has committed $50 million over the next three years to expand young girls' exposure to coding. Some of that money will benefit existing organizations like Girls Who Code and Black Girls Code, while the rest will fund marketing campaigns to change the weak reputation programming has among young girls. Square and Codeacademy are encouraging coding among girls in similar fashion.

"None of us created all this bias in the world, but as we become conscious of it and aware of it, we need to debug it," says Megan Smith, the vice president inside the Google X "moonshot" lab who is leading Made for Code. "We need to use the same innovative people that make these products to debug and fix this problem."

The problem is not a small one. Over the last two months, Google, LinkedIn, Yahoo, and, most recently, Facebook have released employee demographic data. At all four companies, 61 to 70 percent of the staff is male, and the gender gap becomes more glaring when you set aside non-tech jobs. Both Facebook and Yahoo reported that 85 percent of tech-related jobs at their companies were filled by men.

The fact these companies are confessing this at all is one promising sign they’re finally ready to make a change. Admitting you have a problem, the saying goes, is the first step to recovery. But Google, Square, and Codeacademy are going a step further.

Research has long shown the number of young girls pursuing computer science is dwindling at an alarming rate. In 2013, just 14 percent of bachelor's degrees in computer science were awarded to women. Other surveys have found less than one percent of girls plan to major in computer science. For years, well-meaning nonprofits have urged the tech community to pay closer attention to these numbers. Now, it seems, the community is listening.

It's Cool to Code

Before launching its new campaign, Google conducted extensive research on the subject and found that among young girls, computer science has a major perception problem. In fact, according to one survey, the most common word girls who aren't familiar with computer science associated with the field was "boring."

Google[x] Vice President Megan Smith speaks during "Google's Made With Code" launch event to inspire girls to code. Taylor Hill/FilmMagic for Google

"The level of misinformation and stereotyping is extraordinary," says Smith. And so, Google rounded up female programmers from organizations as diverse as UNICEF and Pixar, and got them to tell their stories on video. Google also came up with coding projects geared toward girls and made them available on MadeWithCode.com. Then, to reinforce the point that coding is cool, Google held a kickoff event in New York City late last month, hosted by actress Mindy Kaling, with appearances by Chelsea Clinton and the band Icona Pop.

Google's larger efforts were also evident last week at the company's massive Google I/O developers conference. By distributing conference tickets through organizations such as Girls Who Code and the Anita Borg Institute for Women and Technology, the company raised female attendance to 20 percent—up from 8 percent last year—and it has made a greater effort to highlight women speakers at the conference. "We're saying: 'These are really fun jobs. They're interesting. They're collaborative. They're creative. They're paid well,'" says Smith. "There are all these attributes that a lot of kids would be interested in if they knew about it."

Increasing Access

But perception isn't the only reason girls aren't coding. For many of them, access is a problem too. According to Code.org, nine out of 10 schools in the U.S. don't even offer computer science courses. Codecademy, a startup based in New York City that offers free coding classes online, hopes to help. Last month, the company joined DonorsChoose.org, a nonprofit that raises money for school supplies, to offer high school girls and teachers $1 million in incentives for taking Codecademy classes. Every girl who completes a Codecademy course is entitled to $125 in DonorsChoose credits. Teachers who help at least four girls complete their courses get another $500 in credits.

"We thought if we were offering an incentive, we wanted to do it in a way that had multiple benefits," says Zach Sims, CEO of Codecademy. "Paying purely in cash might not provide the right incentives. But paying with DonorsChoose credits means we're improving the availability of technology and other resources."

DonorsChoose and Codecademy raised $1 million from Google under the Made With Code initiative. It's roughly enough, Sims says, to double the number of girls in the United States who are currently taking computer science courses without waiting for schools to incorporate computer science into the curriculum.

A Safe Place

Of course, the dirty little secret about why there aren't more female programmers is the fact women who do pursue programming almost always are outnumbered by men. In a high school or even college classroom, that can be an intimidating thing—intimidating enough, at times, to drive young women out of the field, altogether. This is the piece of the problem Square has chosen to fix. Last summer, it launched its first Code Camp for college girls pursuing degrees in computer science. It's an immersive four-day program that includes technical sessions, leadership talks, and a hackathon. For many of the women participating, it is the first time they've gotten to code with a group of women.

Square

"It was ok to ask questions, and it was ok to be vulnerable," says Square engineer Kat Hawthorne, who participated in Code Camp when she was in college. "I realized that a lot of these girls felt the same pressures I did in a male-dominated field. It's difficult to raise your hand and let your ignorance shine, because there's the internal voice saying maybe you're not good enough."

The success of Square's college Code Camp, which is taught by Square staffers, inspired the company to launch a High School Code Camp last fall. As part of the eight-month, after-school program, girls from local San Francisco high schools attended classes at Square twice a week to prepare for the AP Computer Science test. This year's program was so successful that one Square staffer has now joined San Francisco's school board to figure out how to scale it. "I just feel like we can talk all we want about how we want more women in engineering," says Sarah Friar, Square's CFO, "but if we don't start small with some basics, things will never change."

Here's to a good start.