You Don't Have to Be Good at Math to Learn to Code

Learning to program involves a lot of Googling, logic, and trial-and-error—but almost nothing beyond fourth-grade arithmetic.

I’m not in favor of anyone learning to code unless she really wants to. I believe you should follow your bliss, career-wise, because most of the things you’d buy with all the money you’d make as a programmer won’t make you happy. Also, if your only reason for learning to code is because you want to be a journalist and you think that’s the only way to break into the field, that’s false.

I’m all for people not becoming coders, in other words—as long they make that decision for the right reasons. “I’m bad at math” is not the right reason.

Math has very little to do with coding, especially at the early stages. In fact, I’m not even sure why people conflate the two. (Maybe it has to do with the fact that both fields are male-dominated.)

Victoria Fine, Slate’s strategy director, has a good piece up this week about how she taught herself how to code despite hating math. Her secret? Lots and lots of Googling.

Like any good Google query, a successful answer depended on asking the right question. “How do I make a website red” was not nearly as successful a question as “CSS color values HEX red” combined with “CSS background color.” I spent a lot of time learning to Google like a pro. I carefully learned the vocabulary of HTML so I knew what I was talking about when I asked the Internet for answers.

Fine’s experience is typical among coding autodidacts, and it resembles my own learning-to-code death march adventure. In the beginning, you’re memorizing some basic concepts, like how the Internet works, what code does, how to FTP, and so forth. Then you build on that knowledge—primarily through Googling, trial, and error—as you explore your language(s) of choice.

In order to figure out what your program should say, you’re going to need some basic logic skills. You’ll also need to be skilled at copying and pasting things from online repositories and tweaking them slightly. But humanities majors, fresh off writing reams of term papers, are probably more talented at that than math majors are.

I know plenty of people with bachelor’s, master’s, and even doctorate degrees in philosophy or international relations who have taught themselves to code. It’s true that some types of code look a little like equations. But you don’t really have to solve them, just know where they go and what they do. The programmer and entrepreneur Emma Mulqueeny puts it well:

In most cases you can see that the hard maths (the physical and geometry) is either done by a computer or has been done by someone else. While the calculations do happen and are essential to the successful running of the program, the programmer does not need to know how they are done.

People who program video games probably need more math than the average web designer. But if you just want to code some stuff that appears on the Internet, you got all the math you’ll need when you completed the final level of Math Blaster. (Here’s a good overview of the math skills required for entry-level coding. The hardest thing appears to be the Pythagorean theorem.)

From my experience, one thing you do need when learning to code is an ability to stifle your rage when computers don’t do what you want. Which is, alas, why I am not a good coder.

Olga Khazan is a staff writer at The Atlantic. She is the author of Weird: The Power of Being an Outsider in an Insider World. She has also written for The New York Times, the Los Angeles Times, The Washington Post, and other publications. She writes a Substack on personality change.