How do I know this?
Well I just know.
Oh - you are expecting more?
What do you mean, that isn't enough? It seems that it is enough whenever religious apologists claim that they know that the truth comes only from their own holy book.
Since I most often see this question from Christians (due to the happenstance of my own particular cultural background) I will use the Christian holy book to give an answer that Christians might (possibly) at least think about.
I refer you to St Paul's Letter to the Romans in the words of the King James Version:
1:18 For the wrath of God is revealed from heaven against all ungodliness and unrighteousness of men, who hold the truth in unrighteousness;
1:19 Because that which may be known of God is manifest in them; for God hath shewed it unto them.
1:20 For the invisible things of him from the creation of the world are clearly seen, being understood by the things that are made, even his eternal power and Godhead; so that they are without excuse:
1:21 Because that, when they knew God, they glorified him not as God, neither were thankful; but became vain in their imaginations, and their foolish heart was darkened.
1:22 Professing themselves to be wise, they became fools,
1:23 And changed the glory of the uncorruptible God into an image made like to corruptible man, and to birds, and fourfooted beasts, and creeping things.
Perhaps I ought to translate that, as it is written in a sort of code - the code of the King James Bible.
What it means is that Paul is answering the question that is often asked. How do the people who have not been fortunate to be born into Christian families get saved? How come they are not doomed to everlasting damnation?
Paul tells is that is is simply obvious to all living things that everything was created by God.
In the New English Bible it might be a bit clearer
1:18-19 For we see divine retribution revealed from heaven and falling on all the godless wickedness of men. In their wickedness they are stifling the truth. For all that may be known of God by men lies plain before their eyes: and indeed God has disclosed it to them. His invisible attributes, that is to say his everlasting power and deity, have been visible, ever since the world began, to the eye of reason, in the things that he has made. There is therefore no possible defence for their conduct . . .
So there you are. Right and wrong are apparently obvious - even to the unbelievers.
Is it obvious to you?
Next time a Christian asks you how you know what is right and wrong if you are an unbeliever, just refer them to the words of Paul. Paul says that it is obvious. Paul is always right.
I'll return to the topic of right and wrong in a few days time - this time with a question for believers.