Wiles was born in 1953 in Cambridge, England, the son of Maurice Frank Wiles (1923–2005), the Regius Professor of Divinity at the University of Oxford, and Patricia Wiles (nee Mowll). His father worked as the Chaplain at Ridley Hall, Cambridge, for the years 1952–55. Wiles attended King's College School, Cambridge, and The Leys School, Cambridge.

Wiles states that he came across Fermat's Last Theorem on his way home from school when he was 10 years old. He stopped by his local library where he found a book about the theorem. Fascinated by the existence of a theorem that was so easy to state that he, a ten-year-old, could understand it, but nobody had proven it, he decided to be the first person to prove it. However, he soon realised that his knowledge was too limited, so he abandoned his childhood dream, until it was brought back to his attention at the age of 33 by Ken Ribet's 1986 proof of the epsilon conjecture, which Gerhard Frey had previously linked to Fermat's famous equation.

Wiles earned his bachelor's degree in mathematics in 1974 at Merton College, Oxford, and a PhD in 1980 at Clare College, Cambridge. After a stay at the Institute for Advanced Study in New Jersey in 1981, Wiles became a professor at Princeton University. In 1985–86, Wiles was a Guggenheim Fellow at the Institut des Hautes Etudes Scientifiques near Paris and at the Ecole Normale Superieure. From 1988 to 1990, Wiles was a Royal Society Research Professor at the University of Oxford, and then he returned to Princeton. He rejoined Oxford in 2011 as Royal Society Research Professor.

Wiles's graduate research was guided by John Coates beginning in the summer of 1975. Together these colleagues worked on the arithmetic of elliptic curves with complex multiplication by the methods of Iwasawa theory. He further worked with Barry Mazur on the main conjecture of Iwasawa theory over the rational numbers, and soon afterward, he generalised this result to totally real fields.

Starting in the summer of 1986, based on successive progress of the previous few years of Gerhard Frey, Jean-Pierre Serre and Ken Ribet, it became clear that Fermat's Last Theorem could be proven as a corollary of a limited form of the modularity theorem (unproven at the time and then known as the "Taniyama–Shimura-Weil conjecture"). The modularity theorem involved elliptic curves, which was also Wiles' own specialist area.

The conjecture was seen by contemporary mathematicians as important, but extraordinarily difficult or perhaps impossible to prove. For example, Wiles' ex-supervisor John Coates states that it seemed "impossible to actually prove", and Ken Ribet considered himself "one of the vast majority of people who believed [it] was completely inaccessible", adding that "Andrew Wiles was probably one of the few people on earth who had the audacity to dream that you can actually go and prove [it]."

Despite this, Wiles, who had a childhood fascination with Fermat's Last Theorem, decided to undertake the challenge of proving the conjecture at least to the extent needed for Frey's curve. He dedicated all of his research time to this problem for over 6 years in near-total secrecy, covering up his efforts by releasing prior work in small segments as separate papers and confiding only in his wife. In 1993, he presented his proof to the public for the first time at a conference in Cambridge. In August 1993 it was discovered that the proof contained a flaw in one area. Wiles tried and failed for over a year to repair his proof. According to Wiles, the crucial idea for circumventing, rather than closing this area, came to him on 19 September 1994 when he was on the verge of giving up. Together with his former student Richard Taylor, he published a second paper which circumvented the problem and thus completed the proof. Both papers were published in 1995 in a special volume of the *Annals of Mathematics*.

His proof of Fermat's Last Theorem has stood up to the scrutiny of the world's other mathematical experts. Wiles was interviewed for an episode of the BBC documentary series *Horizon* that focused on Fermat's Last Theorem. This was renamed "The Proof", and it was made an episode of the Public Broadcasting Service's science television series *Nova*. His work and life are also mentioned in great detail in Simon Singh's popular book, Fermat's Last Theorem. He has been a foreign member of the US National Academy of Sciences since 1996.

Wiles has been awarded a number of major prizes in mathematics and science:

Junior Whitehead Prize of the LMS (1988)
Fellow of the Royal Society (1989)
Schock Prize (1995)
Fermat Prize (1995)
Wolf Prize (1995/6)
NAS Award in Mathematics from the National Academy of Sciences (1996)
Royal Medal (1996)
Ostrowski Prize (1996)
Cole Prize (1997)
Wolfskehl Prize (1997) – see Paul Wolfskehl
A silver plaque from the International Mathematical Union (1998) recognising his achievements, in place of the Fields Medal, which is restricted to those under 40 (Wiles was born in 1953 and proved the theorem in 1994)
King Faisal Prize (1998)
Clay Research Award (1999)
Pythagoras Award (Croton, 2004)
Shaw Prize (2005)
The asteroid 9999 Wiles was named after Wiles in 1999.
Wiles was appointed to the rank of Knight Commander of the Order of the British Empire in the United Kingdom in 2000.
The building at the University of Oxford housing the Mathematical Institute is named after Wiles
Wiles nomination for election to the Royal Society reads:

Andrew Wiles is almost unique amongst number-theorists in his ability to bring to bear new tools and new ideas on some of the most intractable problems of number theory. His finest achievement to date has been his proof, in joint work with Mazur, of the "main conjecture" of Iwasawa theory for cyclotomic extensions of the rational field. This work settles many of the basic problems on cyclotomic fields which go back to Kummer, and is unquestionably one of the major advances in number theory in our times. Earlier he did deep work on the conjecture of Birch and Swinnerton-Dyer for elliptic curves with complex multiplication – one offshoot of this was his proof of an unexpected and beautiful generalisation of the classical explicit reciprocity laws of Artin-Hasse-Iwasawa. Most recently, he has made new progress on the construction of l-adic representations attached to Hilbert modular forms, and has applied these to prove the "main conjecture" for cyclotomic extensions of totally real fields – again a remarkable result since none of the classical tools of cyclotomic fields applied to these problems.

An episode of *Star Trek: The Next Generation*, filmed while Wiles was researching the proof, asserted that Fermat's Last Theorem remains unproven in the 24th century. An episode of *Star Trek: Deep Space Nine* mentioned Wiles's proof.
He was also mentioned in Stieg Larsson's second book of the Millennium trilogy *The Girl Who Played With Fire*, and also the third, *The Girl Who Kicked the Hornets' Nest*. Wiles was credited with solving Fermat's Last Theorem when the female protagonist Lisbeth Salander attempted to solve it.
Tom Lehrer updated the lyrics to his song *That's Mathematics*, to mention that Wiles "confirms what Fermat / Jotted down in that margin / Which could've used some enlargin'."
Rock band Bats have a song named after Wiles which describes his career.
Rock Band Kineto wrote a song about his endless pursuit to solve Fermat's Last Theorem.
Wiles and his achievement are also mentioned in Yoko Ogawa's novel *The Housekeeper and the Professor*.
Wiles' 1993 presentation in Cambridge is mentioned in the novel *The Oxford Murders* by Guillermo Martinez, which was adapted into a film of the same title. In the film, Wiles is represented as "Professor Wilkes" of Cambridge who addressed "Bormat's Last Theorem".