There is no direct evidence to indicate when King Lear was written or first performed. It is thought to have been composed sometime between 1603 and 1606. A Stationers' Register entry notes a performance before James I on 26 December 1606. The 1603 date originates from words in Edgar's speeches which may derive from Samuel Harsnett's Declaration of Egregious Popish Impostures (1603). A significant issue in the dating of the play is the relationship of King Lear to the play titled The True Chronicle History of the Life and Death of King Leir and his Three Daughters, which was published for the first time after its entry in the Stationers' Register of 8 May 1605. This play had a significant effect on Shakespeare, and his close study of it suggests that he was using a printed copy, which suggests a composition date of 1605–6. Conversely, Frank Kermode, in the Riverside Shakespeare, considers the publication of Leir to have been a response to performances of Shakespeare's already-written play; noting a sonnet by William Strachey that may have verbal resemblances with Lear, Kermode concludes that "1604-5 seems the best compromise".
A line in the play that regards "These late eclipses in the sun and moon" appears to refer to a phenomenon of two eclipses that occurred over London within a few days of each other — the lunar eclipse of 27 September 1605 and the solar eclipse of 2 October 1605. This remarkable pair of events stirred up much discussion among astrologers. Edmund’s line "A prediction I read this other day…" apparently refers to the published prognostications of the astrologers, which followed after the eclipses. This suggests that those lines in Act I were written sometime after both the eclipses and the published comments.
The modern text of King Lear derives from three sources: two quartos, one published in 1608 (Q1) and the other in 1619 (Q2)[a], and the version in the First Folio of 1623 (F1). The differences between these versions are significant. Q1 contains 285 lines not in F1; F1 contains around 100 lines not in Q1. Also, at least a thousand individual words are changed between the two texts, each text has different styles of punctuation, and about half the verse lines in the F1 are either printed as prose or differently divided in the Q1. Early editors, beginning with Alexander Pope, conflated the two texts, creating the modern version that has been commonly used since. The conflated version originated with the assumptions that the differences in the versions do not indicate any re-writing by the author; that Shakespeare wrote only one original manuscript, which is now lost; and that the Quarto and Folio versions contain various distortions of that lost original. Other editors, such as Nuttall and Bloom, have suggested Shakespeare himself maybe have been involved in reworking passages in the play to accommodate performances and other textual requirements of the play.
As early as 1931, Madeleine Doran suggested that the two texts had independent histories, and that these differences between them were critically interesting. This argument, however, was not widely discussed until the late 1970s, when it was revived, principally by Michael Warren and Gary Taylor, who discuss a variety of theories including Doran's idea that the Quarto may have been printed from Shakespeare's foul papers, and that the Folio may have been printed from a promptbook prepared for a production.
The New Cambridge Shakespeare has published separate editions of Q and F; the most recent Pelican Shakespeare edition contains both the 1608 Quarto and the 1623 Folio text as well as a conflated version; the New Arden edition edited by R. A. Foakes offers a conflated text that indicates those passages that are found only in Q or F. Both Anthony Nuttall of Oxford University and Harold Bloom of Yale University have endorsed the view of Shakespeare having revised the tragedy at least once during his lifetime. As Bloom indicates: "At the close of Shakespeare's revised King Lear, a reluctant Edgar becomes King of Britain, accepting his destiny but in the accents of despair. Nuttall speculates that Edgar, like Shakespeare himself, usurps the power of manipulating the audience by deceiving poor Gloucester."