Freemasonry is not a religion. In the early days of its establishment, it was a secret association. There was no requirement on whether the applicants had religious beliefs or what religious background. Adult men without disabilities holding various religious beliefs were allowed to join, but the applicants must be theists (Jews, Christians, Hindus, etc.), believing that there was a God.
The theosophy of the Freemasons obviously inherited the religious thought of Gnosticism (Gnosticism, the general name of various Hellenistic sects fighting against Christianity in the open period of Christianity, which flourished in the first century A.D., collapsed due to the pressure of Christianity in the fourth century, and the remaining forces became secret religions). In addition to Gnosticism, freemasonry also contains many elements of Kabala (secret philosophy of Judaism) and Latin alchemy, which rose around the 13th century.
Source: @sakoetattoos