Mazdak was the chief representative of a religious and philosophical teaching called Mazdakism, which he viewed as a reformed and purified version of Zoroastrianism, although his teaching has been argued to display influences from Manichaeism as well. Zoroastrianism was the dominant religion of Sassanid Persia, and Mazdak himself was a mobad or Zoroastrian priest, but most of the clergy regarded his teaching as heresy. Information about it is scarce and details are sketchy, but some further details may be inferred from the later doctrine of the Khurramites, which has been seen as a continuation of Mazdakism.
Some sources claim that the original founders of this sect lived earlier than Mazdak. These were another mobad, Zaradust-e Khuragen (distinct from the founder of Zoroastrianism, Zoroaster, Middle Persian Zardusht) and/or a Zoroastrian philosopher known as Mazdak the Elder, who taught a combination of altruism and hedonism: "he directed his followers to enjoy the pleasures of life and satisfy their appetite in the highest degree with regard to eating and drinking in the spirit of equality, to aim at good deeds; to abstain from shedding blood and inflicting harm on others; and to practise hospitality without reservation". This doctrine was further developed by the much better-known Mazdak the Younger, son of Bāmdād.
At later stages the conservative Zoroastrian opposition accused Mazdak's followers of heresy and with abhorrent practices such as the sharing of women, for which scholars have found no evidence. Mazdak's followers are considered to be the first real socialists in human history by their emphasis on community property and community work with benefits accruing to all.
Like both Zoroastrianism (at least as practised at the time) and Manichaeism, Mazdakism had a dualistic cosmology and worldview. This doctrine taught that there were two original principles of the universe: Light, the good one; and Darkness, the evil one. These two had been mixed by a cosmic accident, tainting everything except God. Light is characterized by knowledge and feeling, and acts by design and free will, whereas Darkness is ignorant and blind, and acts at random. Mankind's role in this life was, through good conduct, to release the parts of himself that belonged to Light. But where Manichaeism saw the mixture of good and bad as a cosmic tragedy, Mazdak viewed this in a more neutral, even optimistic way.
In addition, Mazdakism is reported, in one late work, to have distinguished three elements (Fire, Water, Earth), and four Powers (Discernment, Understanding, Preservation and Joy, corresponding to the four chief officials of the Sassanid state – the Chief Mobad (Mobadan Mobad), the Chief Herbad, the Commander of the Army and the Entertainment Master), seven Viziers and twelve Spiritual Forces. When the Four, the Seven and the Twelve were united in a human being, he was no longer subject to religious duties. In addition, God was believed to rule the world through letters, which held the key to the Great Secret that should be learned. This description suggests that Mazdakism was, in many ways, a typical Gnostic sect.
Two distinguishing factors of Mazdak's teaching were the reduction of the importance of religious formalities—the true religious person being the one who understood and related correctly to the principles of the universe—and a criticism of the strong position of mainstream clergy, who, he believed, had oppressed the Persian population and caused much poverty.
Mazdak emphasised good conduct, which involved a moral and ascetic life, no killing and vegetarianism (considering meat to contain substances derived solely from Darkness), being kind and friendly and living in peace with other people.
In many ways Mazdak's teaching can be understood as a call for social revolution, and has been referred to as early "communism". He and his followers were also advocates of free love.
According to Mazdak, God had originally placed the means of subsistence on earth so that people should divide them among themselves equally, but the strong had coerced the weak, seeking domination and causing the contemporary inequality. This in turn empowered the "Five Demons" that turned men from Righteousness—these were Envy, Wrath, Vengeance, Need and Greed. To prevail over these evils, justice had to be restored and everybody should share excess possessions with his fellow men. Mazdak allegedly planned to achieve this by making all wealth common or by re-distributing the excess, although it is unclear how he intended to organize that in terms of regulations and to what extent his position has been caricatured by hostile sources. The hostile sources mostly dwell on the alleged "sharing" of women, the resulting sexual promiscuity and the confusion of the line of descent. Since the latter is a standard accusation against heretical sects, its veracity has been doubted by researchers; it is likely that Mazdak took measures against the widespread polygamy of the rich and lack of wives for the poor.