By the summer of 1891 Wilde had already written three plays, Vera; or, The Nihilists and The Duchess of Padua had found little success, and Salome had been censored. Unperturbed, he decided to write another play but turned from tragedy to comedy. He went to the Lake District in the north of England, where he stayed with a friend and later met Robert Ross. Numerous characters in the play appear to draw their names from the north of England: Lady Windermere from the lake and nearby town Windermere (though Wilde had used "Windermere" earlier in Lord Arthur Saville's Crime), the Duchess of Berwick from Berwick-upon-Tweed, Lord Darlington from Darlington. Wilde began writing the play at the prodding of Sir George Alexander, the actor manager of St James's Theatre. The play was finished by October. Alexander liked the play, and offered him an advance of £1,000 for it. Wilde, impressed by his confidence, opted to take a percentage instead, from which he would earn £7,000 in the first year alone (worth £679,900 today).
Alexander was a meticulous manager and he and Wilde began exhaustive revisions and rehearsals of the play. Both were talented artists with strong ideas about their art. Wilde, for instance, emphasised attention to aesthetic minutiae rather than realism; he resisted Alexander's suggested broad stage movements, quipping that "Details are of no importance in life, but in art details are vital". These continued after the opening night, when at the suggestion of both friends and Alexander, Wilde made changes to reveal Mrs Erylnne's relationship with Lady Windermere gradually throughout the play, rather than reserving the secret for the final act. Despite these artistic differences, both were professional and their collaboration was a fruitful one.
There exists an extant manuscript of the play and it is held in the William Andrews Clark Memorial Library at the University of California in Los Angeles.