A choirboy is a boy member of a choir, also known as a treble.
As a derisive slang term, it refers to a do-gooder or someone who is morally upright, in the same sense that "Boy Scout" (also derisively) refers to someone who is considered honorable or conscientious.
The use of choirboys in Christian liturgical music can be traced back to pre-Christian times. Saint Paul's dictum that "women should be silent in churches" (mulieres in ecclesiis taceant) resonated with this largely patriarchal tradition; the development of vocal polyphony from the Middle Ages through the Renaissance and Baroque thus took place largely, though not exclusively, in the context of the all-male choir, in which all voice parts were sung by men and boys.
The first known usage in print of the term "choirboy" (rather than the earlier "singing boy") was by the Victorian novelist William Makepeace Thackeray (1811–1863) in chapter vii of his story The Ravenswing, published in Fraser's Magazine for Town and Country (London, Sept. 1843, XXVIII/165, p. 321): "He had been a choir-boy at Windsor".
In more recent years as girls have begun joining formerly all-male choirs, the gender-neutral term chorister is more often being used instead. (Until the late 20th century chorister was sometimes applied to adult choral singers too, but is now limited to children.)
Boys are generally eligible to join a choir at the age of seven. Voice trials are part of the selection process for larger choirs and tend to measure the quality of voice and pitch recognition rather than singing experience. Boys that are accepted into a choir begin as probationers.
Extensive musical training is provided, in particular for cathedral choristers. A number of famous composers and musicians began their careers as choristers. In 1740, Joseph Haydn was sent at the age of eight to Vienna to become a choirboy at Saint Stephen's Cathedral. Franz Schubert was accepted into the choir of the Imperial Court Chapel in 1808 when he was 11. Dudley Moore became a choirboy at six.