Born in La Jolla, California, McKellar moved with her family to Los Angeles when she was eight. Her mother Mahalia was a homemaker; her father Christopher is a real estate developer. She is of paternal Scottish, French, German, Spanish, Dutch descent and her mother is of Portuguese origin via the Azores and Madeira islands.
Danica and her sister Crystal McKellar both maintained professional acting careers as children, but with a strong emphasis on education as a priority. As a result, Crystal became a corporate lawyer, while Danica majored in mathematics. Danica and Crystal also have two half-brothers, Chris Junior and Connor McKellar.
McKellar studied at UCLA and earned a Bachelor of Science in Mathematics with highest honors (summa cum laude) in 1998. As an undergraduate, she coauthored a scientific paper with Professor Lincoln Chayes and fellow student Brandy Winn titled "Percolation and Gibbs states multiplicity for ferromagnetic Ashkin–Teller models on Z 2 ." Their results are termed the "Chayes–McKellar–Winn theorem". Later, when Chayes was asked to comment about the mathematical abilities of his student coauthors, he was quoted in The New York Times, "I thought that the two were really, really first-rate." For her past collaborative work on research papers, McKellar is currently assigned the Erdős number four, and her Erdős–Bacon number is six.
At age seven, McKellar enrolled in weekend acting classes for children at the Lee Strasberg Institute in Los Angeles. In her teens, she landed a prominent role in The Wonder Years, an American television comedy-drama that ran for six seasons on ABC, from 1988 to 1993. She played Gwendolyn "Winnie" Cooper, the main love interest of Kevin Arnold (played by Fred Savage) on the show. Her first kiss was with Fred Savage in an episode of The Wonder Years.
She later said, "My first kiss was a pretty nerve-wracking experience! But we never kissed off screen, and pretty quickly our feelings turned into brother/sister, and stayed that way." Late-night talk show host Jimmy Fallon has said that the character of Winnie Cooper "is the coolest girl in any TV show ever."
McKellar has said that she found it difficult to move from being a child actress to an adult actress." Since leaving The Wonder Years, McKellar has had several guest roles in television series (including one with former co-star Fred Savage on Working), and has written and directed two short films. She appeared in two Lifetime TV movies in the Moment of Truth series, playing Kristin Guthrie in 1994's Cradle of Conspiracy and Annie Mills Carman in 1996's Justice for Annie. She briefly returned to regular television with a recurring role in the 2002–03 season of The West Wing, portraying Elsie Snuffin, the stepsister and assistant of Deputy White House Communications Director Will Bailey.
In 1989, she appeared playing the cello at the beginning of the Debbie Gibson music video No More Rhyme.
McKellar appeared in lingerie in the July 2005 edition of Stuff magazine after readers voted her the 1990s star they would most like to see in lingerie. McKellar explained that she agreed to the shoot in part to obtain "grittier roles".
In 2006, McKellar starred in a Lifetime movie and web-based series titled Inspector Mom about a mother who solves mysteries.
On the August 1, 2007, edition of the Don and Mike Show, a WJFK-FM radio program out of Washington, D.C., McKellar announced plans that the producers of How I Met Your Mother were planning to bring her back for a recurring role (she guest-starred on the show in late 2005 in "The Pineapple Incident" and again in early 2007 in "Third Wheel"). She also made an appearance on the show The Big Bang Theory, in the episode "The Psychic Vortex".
In 2008, she starred in Heatstroke, a Sci-Fi Channel original movie about searching for alien life on Earth and in 2009 she was one of the stars commenting on the occurrences of the new millennium in VH1's I Love the New Millennium and was the math correspondent for Brink, a program by the Science Channel about technology. In 2013, she played Ellen Plainview in Lifetime's reimagining of the 1956 Alfred Hitchcock film The Wrong Man.
McKellar has also found work as a voice actress. She is the voice of Miss Martian in Young Justice. She has also provided the voices for two characters in three video games: Jubilee in X-Men Legends (2004), and Invisible Woman in Marvel: Ultimate Alliance (2006) and Marvel: Ultimate Alliance 2 (2009).
In 2012, she starred in the Lifetime movie, Love at the Christmas Table with Dustin Milligan.
In 2013, she starred in the Syfy movie Tasmanian Devils with Apolo Ohno.
On March 4, 2014, she was announced to be joining season 18 of Dancing with the Stars. She paired with Valentin Chmerkovskiy. McKellar and Chmerkovskiy were eliminated on Week 8, finishing in 6th place.
She had a guest appearance in the Impractical Jokers season four episode six titled "The Blunder Years"
In 2015, she starred in the Netflix original series Project Mc2 as The Quail.
She has starred in several Hallmark Channel movies, including Crown for Christmas, My Christmas Dream, and Campfire Kiss.
She married composer Mike Verta on March 22, 2009, in La Jolla, California; the couple had dated since 2001. They had their first child, a son named Draco, in 2010. McKellar filed for divorce from Verta in June 2012, with the dissolution becoming final in February 2013.
On July 16, 2014, she was engaged to her boyfriend Scott Sveslosky, a partner in the Los Angeles legal firm Sheppard Mullin Richter and Hampton. On November 15, 2014, the two wed in Kauai, Hawaii.
McKellar has authored several mathematics-related books primarily targeting adolescent readers interested in succeeding at the study of mathematics:McKellar, Danica; Mary Lynn Blasutta (2008). Math Doesn't Suck: How to Survive Middle School Math without Losing Your Mind or Breaking a Nail. New York: Plume. ISBN 9780452289499. McKellar, Danica (2009). Kiss My Math: Showing Pre-Algebra Who's Boss. New York: Plume. ISBN 9780452295407. McKellar, Danica (2010). Hot X: Algebra Exposed. New York: Plume. ISBN 9780452297197. McKellar, Danica (2012). Girls Get Curves: Geometry Takes Shape. New York: Hudson Street Press. ISBN 9781594630941.
Her first book, Math Doesn't Suck: How to Survive Middle School Math without Losing Your Mind or Breaking a Nail, was a New York Times bestseller, and was favorably reviewed by Tara C. Smith, the founder of Iowa Citizens for Science and a professor of epidemiology at the University of Iowa. The book also received a review from Anthony Jones, writing for the School Librarian journal, who described the book as "a trouble-shooting guide to help girls overcome their biggest maths challenges," noting what he described as "real-world examples of great mathematics in action." 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, was released on August 5, 2008. The book's target audience is girls in the 7th through 9th grades. Her third book, Hot X: Algebra Exposed! covers algebra topics, while the previous two titles were intended as "algebra-readiness books." Hot X was published on August 3, 2010. Her fourth book, Girls Get Curves – Geometry Takes Shape, focuses on the subject of geometry, and attempts to make the subject more accessible.
Three of McKellar's books were listed in The New York Times children's bestseller list.Chayes, L; McKellar, D; Winn, B (1998). "Percolation and Gibbs states multiplicity for ferromagnetic Ashkin–Teller models on Z 2 " (PDF). Journal of Physics A: Mathematical and General. 31 (45): 9055–9063. Bibcode:1998JPhA...31.9055C. doi:10.1088/0305-4470/31/45/005.
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. In January 2014, she received the Joint Policy Board for Mathematics (JPBM) Communications Award. The citation credited her books, blog, and public appearances for encouraging "countless middle and high school students, especially girls, to be more interested in mathematics."
On August 20, 2013, Canadian singer Avril Lavigne released her music video for new single "Rock N Roll" from her upcoming self-titled fifth album, which features McKellar as "Winnie Cooper".
McKellar was featured in Debbie Gibson's 8th single from the Electric Youth album, "No More Rhyme", which was released in 1989. She plays the cello in the beginning of the video.