user-1: I believe in karma and rebirth but I don’t understand one thing. How does five precepts give you merits? Isn’t it only preventing bad karma? If you don’t kill any living beings or don’t steal anything then how do you get merits when you are not doing anything. You are only preventing bad karma. 

user471: The objective of Buddhism is not about keeping a score of bad karma and good karma. Rather, it is about becoming free from suffering and this is related to one's state of mind.
A key benefit of the observance of the five precepts is that it leads to stream entry, which is the first stage of enlightenment. Upon reaching stream entry, one would no longer be reborn in lower realms, and would reach full enlightenment in no more than seven lifetimes.
The Vera Sutta below lists out the criteria for stream entry:

Five forms of fear and animosity are stilled through the observance of the five precepts
Four factors of stream entry
Rightly seen and rightly ferreted out the noble method (dependent origination)

The four factors of stream entry are verified confidence in the Buddha, Dhamma and Sangha, as well as, being endowed with the virtues appealing to the noble ones.
Interestingly, the sutta does not say that the five precepts lead to stream entry. Rather, it says that reaching a certain state of mind i.e. the stilling of the five forms of fear and animosity (which correspond to the five precepts) would lead to stream entry.
If you lie or steal, you would be afraid of being caught. Animosity is with those who could catch you. Observance of the five precepts results in a state of mind free from such fear and animosity. Additionally, virtues also result in a state of mind free of remorse, which is discussed in the Kimattha Sutta (AN 11.1).
From the Vera Sutta (AN 10.92):

Then Anathapindika the householder went to the Blessed One and, on
  arrival, having bowed down to the Blessed One, sat to one side. As he
  was sitting there, the Blessed One said to him, "When, for a disciple
  of the noble ones, five forms of fear & animosity are stilled; when he
  is endowed with the four factors of stream-entry; and when, through
  discernment, he has rightly seen & rightly ferreted out the noble
  method, then if he wants he may state about himself: 'Hell is ended;
  animal wombs are ended; the state of the hungry shades is ended;
  states of deprivation, destitution, the bad bourns are ended! I am a
  stream-winner, steadfast, never again destined for states of woe,
  headed for self-awakening!'
"Now, which five forms of fear & animosity are stilled?
"When a person takes life, then with the taking of life as a requisite
  condition, he produces fear & animosity in the here & now, produces
  fear & animosity in future lives, experiences mental concomitants of
  pain & despair; but when he refrains from taking life, he neither
  produces fear & animosity in the here & now nor does he produce fear &
  animosity in future lives, nor does he experience mental concomitants
  of pain & despair: for one who refrains from taking life, that fear &
  animosity is thus stilled.
"When a person steals... engages in illicit sex... tells lies...
"When a person drinks distilled & fermented drinks that cause
  heedlessness, then with the drinking of distilled & fermented drinks
  that cause heedlessness as a requisite condition, he produces fear &
  animosity in the here & now, produces fear & animosity in future
  lives, experiences mental concomitants of pain & despair; but when he
  refrains from drinking distilled & fermented drinks that cause
  heedlessness, he neither produces fear & animosity in the here & now
  nor does he produce fear & animosity in future lives, nor does he
  experience mental concomitants of pain & despair: for one who refrains
  from drinking distilled & fermented drinks that cause heedlessness,
  that fear & animosity is thus stilled.
"These are the five forms of fear & animosity that are stilled.


user2282: Actually abstaining from breaking the precepts does a lot more than just passive non-doing. By asbstaining from killing, one's given a great gift to many others: the freedom from fear, enmity, and affliction:

"“Here, a noble disciple, having abandoned the destruction of life, abstains from the destruction of life. By abstaining from the destruction of life, the noble disciple gives to an immeasurable number of beings freedom from fear, enmity, and affliction. He himself in turn enjoys immeasurable freedom from fear, enmity, and affliction. This is the first gift, a great gift, primal, of long standing, traditional, ancient, unadulterated and never before adulterated, which is not being adulterated and will not be adulterated, not repudiated by wise ascetics and brahmins. This is the fourth stream of merit … that leads to what is wished for, desired, and agreeable, to one’s welfare and happiness." ~~ AN 8.39 ~~


user111: Karma is a state of the mind. Keeping to  a precept involves many wholesome states of the mind. 
Ex: When a mosquito bites you, aversion to pain and in turn hate towards the mosquito might arise in the mind. But if 
you are keeping to the first precept, the view that killing is wrong will arise in the mind. That is the right view(Samma-ditthi) which is good Karma. Then you will decide not to harm the mosquito. That is the right action(Samma-kammantha) which is good Karma. Or you might see it just as pain and don't react at all. That is the right mindfulness(Samma-sati) and right effort(Samma-vayama) which are good Karma. Or you might do Metta(loving kindness) towards the mosquito to prevent yourself from giving into aversion. That's the right intention(Samma-sankappa) and the right effort which are good Karma. Also when you do Silanussati(reflecting on your virtues), it's again the right mindfulness and the right effort which are good Karma. 
Similar wholesome mind states are involved with other precepts as well.

-1: <p>I believe in karma and rebirth but I don’t understand one thing. How does five precepts give you merits? Isn’t it only preventing bad karma? If you don’t kill any living beings or don’t steal anything then how do you get merits when you are not doing anything. You are only preventing bad karma. </p>
 471: <p>The objective of Buddhism is not about keeping a score of bad karma and good karma. Rather, it is about becoming free from suffering and this is related to one's state of mind.</p>

<p>A key benefit of the observance of the five precepts is that it leads to stream entry, which is the first stage of enlightenment. Upon reaching stream entry, one would no longer be reborn in lower realms, and would reach full enlightenment in no more than seven lifetimes.</p>

<p>The Vera Sutta below lists out the criteria for stream entry:</p>

<ul>
<li>Five forms of fear and animosity are stilled through the observance of the five precepts</li>
<li>Four factors of stream entry</li>
<li>Rightly seen and rightly ferreted out the noble method (dependent origination)</li>
</ul>

<p>The four factors of stream entry are verified confidence in the Buddha, Dhamma and Sangha, as well as, being endowed with the virtues appealing to the noble ones.</p>

<p>Interestingly, the sutta does not say that the five precepts lead to stream entry. Rather, it says that reaching a certain state of mind i.e. the stilling of the five forms of fear and animosity (which correspond to the five precepts) would lead to stream entry.</p>

<p>If you lie or steal, you would be afraid of being caught. Animosity is with those who could catch you. Observance of the five precepts results in a state of mind free from such fear and animosity. Additionally, virtues also result in a state of mind free of remorse, which is discussed in the <a href="https://www.accesstoinsight.org/tipitaka/an/an11/an11.001.than.html" rel="nofollow noreferrer">Kimattha Sutta (AN 11.1)</a>.</p>

<p>From the <a href="https://www.accesstoinsight.org/tipitaka/an/an10/an10.092.than.html" rel="nofollow noreferrer">Vera Sutta (AN 10.92)</a>:</p>

<blockquote>
  <p>Then Anathapindika the householder went to the Blessed One and, on
  arrival, having bowed down to the Blessed One, sat to one side. As he
  was sitting there, the Blessed One said to him, "When, for a disciple
  of the noble ones, five forms of fear &amp; animosity are stilled; when he
  is endowed with the four factors of stream-entry; and when, through
  discernment, he has rightly seen &amp; rightly ferreted out the noble
  method, then if he wants he may state about himself: 'Hell is ended;
  animal wombs are ended; the state of the hungry shades is ended;
  states of deprivation, destitution, the bad bourns are ended! I am a
  stream-winner, steadfast, never again destined for states of woe,
  headed for self-awakening!'</p>
  
  <p>"Now, which five forms of fear &amp; animosity are stilled?</p>
  
  <p>"When a person takes life, then with the taking of life as a requisite
  condition, he produces fear &amp; animosity in the here &amp; now, produces
  fear &amp; animosity in future lives, experiences mental concomitants of
  pain &amp; despair; but when he refrains from taking life, he neither
  produces fear &amp; animosity in the here &amp; now nor does he produce fear &amp;
  animosity in future lives, nor does he experience mental concomitants
  of pain &amp; despair: for one who refrains from taking life, that fear &amp;
  animosity is thus stilled.</p>
  
  <p>"When a person steals... engages in illicit sex... tells lies...</p>
  
  <p>"When a person drinks distilled &amp; fermented drinks that cause
  heedlessness, then with the drinking of distilled &amp; fermented drinks
  that cause heedlessness as a requisite condition, he produces fear &amp;
  animosity in the here &amp; now, produces fear &amp; animosity in future
  lives, experiences mental concomitants of pain &amp; despair; but when he
  refrains from drinking distilled &amp; fermented drinks that cause
  heedlessness, he neither produces fear &amp; animosity in the here &amp; now
  nor does he produce fear &amp; animosity in future lives, nor does he
  experience mental concomitants of pain &amp; despair: for one who refrains
  from drinking distilled &amp; fermented drinks that cause heedlessness,
  that fear &amp; animosity is thus stilled.</p>
  
  <p>"These are the five forms of fear &amp; animosity that are stilled.</p>
</blockquote>
 2282: <p>Actually abstaining from breaking the precepts does a lot more than just passive non-doing. By asbstaining from killing, one's given a great gift to many others: the freedom from fear, enmity, and affliction:</p>

<blockquote>
  <p>"“Here, a noble disciple, having abandoned the destruction of life, abstains from the destruction of life. By abstaining from the destruction of life, the noble disciple gives to an immeasurable number of beings freedom from fear, enmity, and affliction. He himself in turn enjoys immeasurable freedom from fear, enmity, and affliction. This is the first gift, a great gift, primal, of long standing, traditional, ancient, unadulterated and never before adulterated, which is not being adulterated and will not be adulterated, not repudiated by wise ascetics and brahmins. This is the fourth stream of merit … that leads to what is wished for, desired, and agreeable, to one’s welfare and happiness." ~~ <a href="https://suttacentral.net/an8.39/en/bodhi" rel="nofollow noreferrer">AN 8.39</a> ~~</p>
</blockquote>
 111: <p>Karma is a state of the mind. Keeping to  a precept involves many wholesome states of the mind. </p>

<p>Ex: When a mosquito bites you, aversion to pain and in turn hate towards the mosquito might arise in the mind. But if 
you are keeping to the first precept, the view that killing is wrong will arise in the mind. That is the right view(Samma-ditthi) which is good Karma. Then you will decide not to harm the mosquito. That is the right action(Samma-kammantha) which is good Karma. Or you might see it just as pain and don't react at all. That is the right mindfulness(Samma-sati) and right effort(Samma-vayama) which are good Karma. Or you might do Metta(loving kindness) towards the mosquito to prevent yourself from giving into aversion. That's the right intention(Samma-sankappa) and the right effort which are good Karma. Also when you do Silanussati(reflecting on your virtues), it's again the right mindfulness and the right effort which are good Karma. </p>

<p>Similar wholesome mind states are involved with other precepts as well.</p>
