During the American Civil War, Longfellow's oldest son Charles Appleton Longfellow joined the Union cause as a soldier without his father's blessing. Longfellow was informed by a letter dated March 14, 1863, after Charles had left. "I have tried hard to resist the temptation of going without your leave but I cannot any longer," he wrote. "I feel it to be my first duty to do what I can for my country and I would willingly lay down my life for it if it would be of any good". Charles soon got an appointment as a lieutenant but, in November, he was severely wounded in the Battle of New Hope Church (in Virginia) during the Mine Run Campaign. Coupled with the recent loss of his wife Frances, who died as a result of an accidental fire, Longfellow was inspired to write "Christmas Bells".
He wrote the poem on Christmas Day in 1864. "Christmas Bells" was first published in February 1865 in Our Young Folks, a juvenile magazine published by Ticknor and Fields. It was not until 1872 that the poem is known to have been set to music. The English organist, John Baptiste Calkin, used the poem in a processional accompanied with a melody he previously used as early as 1848.