My favourite sources of this simple truth. More to be found on wikipedia

In religious texts (sorted alphabetically, sorry Zoroastrianists)

(…) Treat not others in ways that you yourself would find hurtful

Christianity, Matthew 7:12 (Jesus)

In everything, do to others as you would have them do to you; for this is the law and the prophets So in everything, do to others what you would have them do to you, for this sums up the Law and the Prophets.

Zigong asked, “Is there one word that can serve as a guide for one’s entire life?” The Master answered, “Is it not ‘understanding’ ? Do not impose upon others what you yourself do not desire.”

Hinduism, Mahabharata 5:1517

This is the sum of duty: do not do to others what would cause pain if done to you

Not one of you truly believes until you wish for others what you wish for yourself

Quote

One should treat all creatures in the world as one would like to be treated

What is hateful to you, do not do to your another. This is the whole Torah; all the rest is its interpretation. Go study.

Taoism

Regard your neighbor’s gain as your own gain, and your neighbor’s loss as your own loss (Taishang Ganying Pian a.k.a. Lao Tse’s Treatise on the Response of the Tao, 213-228)

300 BCE – 1000 CE

Do not do unto others whatever is injurious to yourself

In other sources

Seneca:

Treat your inferior as you would wish your superior to treat you. (Letter 47 11 – 1st century).

Jainism: “In happiness and sorrow, in joy and in pain, we should consider every creature as we consider ourselves” (Mahavira, 24th Tirthankara – 6th century BC).

Voltaire Put yourself in the other person’s shoes