Semar is a character in Javanese mythology who frequently appears in wayang shadow plays. He is one of the punokawan (clowns), but is in fact divine and very wise. He is the dhanyang (guardian spirit) of Java, and is regarded by some as the most sacred figure of the wayang set. He is said to be the god Sang Hyang Ismaya in human form.
In depictions, Semar appears with a flat nose, a protruding lower jaw, a tired eye, and bulging rear, belly, and chest. He wears a checkered hipcloth, symbolizing sacredness. Like the other panakawan, the wayang kulit puppet does not have the elaborate openwork and ornamentation characteristic of the heroes In wayang wong, Semar always leans forward, one hand palm up on his back and the other extended partly forward, moving up and down, with an extended forefinger.
By tradition Semar has three sons, the other punakawans in the wayang: Gareng, Petruk, and Bagong (Bagong does not appear in Surakarta-style wayang). In some wayangs, he has a brother Togog (or Hyang Antaga), who is the servant-clown of a demonic hero.
As Semar is one of the few characters in wayang stories not from Indian mythology, his origin is obscure. One hypothesis is that he and his sons are old indigenous deities who became cursed and demoted to servants with the importation of the kshatriya heroes of the Indian epics. Semar also resembles the vidusaka clown figure of Indian Sanskrit drama.
The first known appearance of Semar is during the Majapahit era. In 1358 in relief of Sudamala in Candi TIgamangi, and in Candi Sukuh dated 1439. The relief was copied from a wayang story from the period, where Semar was first known to be appeared. 
In one version of the Babad Tanah Jawi (the Javanese creation myth), Semar cultivated a small rice field near Mount Merbabu for ten thousand years before there were any men. His descendants, the spirits of the island, came into conflict with people as they cleared fields and populated the island. A powerful priest, unable to deviate from his king's orders to continue cultivating the island, provided Semar with a role that will allow his children and grandchildren to stay. Semar's role was to be a spiritual advisor and magical supporter of the royalty, and those of his descendants who also protect the humans of Java can remain there.
One genealogy of Semar is that he is the eldest descendant of God, and elder brother to Batara Guru, king of the other gods; however, Semar became a man. Another genealogy says that he is the son of Adam and Eve. His brother Nabi ("prophet") Sis gave birth to various prophets, such as Jesus and Muhammad, from whom the various Western peoples are descended, while Semar ("Sayang Sis") gave birth to the Hindus and the Javanese. In either case Semar, in his awkward, ugly human form, represents at the same time god and clown, the most spiritually refined and outwardly rough.
Semar and his sons first appear in the second part of the plays (pathet sanga), as the servants and counselors of whoever the hero of the wayang play is. In wayang plots Semar is never mistaken, and is deceptively powerful. He is the only character who dares to protest to the gods, including Batara Guru (Shiva) and Batari Durga, and even compel them to act or desist.
He often represents the realistic view of the world in contrast to the idealistic. His role as servant is to cheer up those in despair and blunt the pride of the triumphant. Clifford Geertz compared his role vis-à-vis Arjuna to that of Prince Hal with his father in Shakespeare's Henry IV, and his role as critic of the play's worldview and antidote to pride as similar to Falstaff.
It has also been suggested that Semar is a symbol of the peasantry, not otherwise incorporated in the palace hierarchies; that in some more popular forms of the drama, he and the other clowns dominate the royal heroes supports this idea.
There is a low rectangular candi on the Dieng Plateau known as Candi Semar, perhaps originally a treasury, but it is generally assumed by scholars that its name was given to the temple centuries after its erection.