As we know it today, Freemasonry had existed since the early eighteenth century, when four Masonic lodges in London united to form a Grand Lodge to charter new groups and coordinate their activities.
The system practiced by those lodges is called Speculative Masonry instead of Operative Masonry, the craft of stonemasons. Freemasonry combines concepts from the building trade with a myth based on King Solomon's building of the holy temple in Jerusalem. It is thus a "system of morality, veiled in allegory and illustrated by symbols." Freemasonry is not a religion but includes persons of all religious traditions and those who have no religious affiliation.
However, Freemasonry looks farther back through the Rosicrucian's of the Renaissance, the guilds of cathedral builders in the Middle Ages, the Troubadours, Albigensians, and Templars, to the ancient Mysteries of Orpheus, Isis, and Eleusis. It has symbolic links with other similar initiatory orders throughout human history, being the dominant modern form of the ancient Mysteries.
Freemasonry is an organization of persons for study, charitable and social cooperation and betterment, and mutual support in its outer form. In its inner form, however, it seeks, through the working of ancient rituals, to develop and integrate the individual Freemason in a balanced way, to bring about an inner realization of the link we each have with the Life force of the universe, to form a working unit for the evolution of humanity as a whole, and generally to serve the well being of the planet and our fellows.
Freemasonry has no doctrine. It is a system of symbols with implications for a way of living that leads to self-improvement through service to the world. It is compatible with various worldviews and religious or philosophical traditions without being itself limited to any one of them.