The Pledge of Allegiance was written in August 1892 by the socialist minister Francis Bellamy (1855-1931). It was originally published in The Youth's Companion on September 8, 1892. Bellamy had hoped that the pledge would be used by citizens in any country.
In its original form it read:
"I pledge allegiance to my Flag and the Republic for which it stands, one nation, indivisible, with liberty and justice for all."
In 1923, the words, "the Flag of the United States of America" were added. At this time it read:
"I pledge allegiance to the Flag of the United States of America and to the Republic for which it stands, one nation, indivisible, with liberty and justice for all."
In 1954, in response to the Communist threat of the times, President Eisenhower encouraged Congress to add the words "under God," creating the 31-word pledge we say today. Bellamy's daughter objected to this alteration. Today it reads:
"I pledge allegiance to the flag of the United States of America and to the republic for which it stands, one nation under God, indivisible, with liberty and justice for all."
Section 4 of the Flag Code states:
The Pledge of Allegiance to the Flag: "I pledge allegiance to the Flag of the United States of America, and to the Republic for which it stands, one Nation under God, indivisible, with liberty and justice for all.", should be rendered by standing at attention facing the flag with the right hand over the heart. When not in uniform men should remove any non-religious headdress with their right hand and hold it at the left shoulder, the hand being over the heart. Persons in uniform should remain silent, face the flag, and render the military salute."