J.K. Rowling said she first conceived the idea for Harry Potter in 1990.
According to Rowling, the idea came to her during a delayed train journey from Manchester to London. She imagined a boy who did not know he was a wizard, and the concept developed into the Harry Potter series over the following years.
The first novel was not published until 1997, so the idea’s conception and the book’s release were seven years apart. During that period Rowling planned the series, wrote the manuscript, and experienced major personal changes, including her mother’s death and a move to Portugal.
The train story is often retold as if Rowling wrote the whole novel during that journey. She did not. The journey supplied the central idea; the characters, plot, magical institutions, and seven-book structure were developed afterward.