Scholars generally agree that Shakespeare wrote Hamlet between 1599 and 1601. The play was likely first performed in 1603, with the First Quarto published that year and the more authoritative Second Quarto following in 1604. The dating aligns with references in contemporary records and the play's stylistic maturity.