McKellar studied at UCLA, majoring in mathematics. While at UCLA, she became a member of Alpha Delta Pi sorority. She graduated summa cum laude in 1998. As an undergraduate, she coauthored a scientific paper with Professor Lincoln Chayes and fellow student Brandy Winn.  Referring to the mathematical abilities of his coauthor students, Chayes was quoted in the New York Times as saying, "I thought that the two were really, really first-rate."
As a result of her role in the publication, McKellar has an Erdős number of 4. Because she also has a Bacon number of 2 through her acting career, she is one of the few individuals with a finite Erdős–Bacon number; in her case, 6.
McKellar is the author of the book Math Doesn't Suck: How to Survive Middle-School Math without Losing Your Mind or Breaking a Nail (ISBN 1594630399), which encourages girls in middle school to enjoy and succeed at mathematics. The book has been favorably reviewed by Tara C. Smith, the founder of Iowa Citizens for Science and a professor of epidemiology at the University of Iowa. In an interview with Smith, McKellar said that she wrote the book "to show girls that math is accessible and relevant, and even a little glamorous" and to counteract "damaging social messages telling young girls that math and science aren't for them".
McKellar's second book, Kiss My Math: Showing Pre-Algebra Who's Boss (ISBN 9781594630491), was released on August 5, 2008. The book's target audience is girls in the 7th through 9th grades. As of August 24th, 2008, both of Danica's books have made the New York Times bestseller list - in the top 10.
McKellar was named Person of the Week on World News with Charles Gibson for the week ending August 10, 2007. The news segment highlighted her book Math Doesn't Suck and her efforts to help girls develop an interest in mathematics, especially during the middle school years.