Self-defense is a defense to a criminal charge or to tort liability. This means that if you are charged with killing an intruder onto your property, you could argue that you acted in self-defense because you reasonably believed that that aggressor posed a danger to you and your family.
Generally, to argue self-defense, you have to prove that the altercation was not your fault nor did you provoke it, that you had no means to escape or retreat (more on that below), and the danger must be imminent
You are permitted to use enough force in self-defense to halt and danger from attack, but any threat can't be an excuse to just beat that person to a pulp or blow their brains out.
You can't argue self-defense if you killed someone or badly injured them just to defend your property. Personal danger must be involved.
Duty to Retreat & "Stand Your Ground" States
In many states, however, there is a duty to retreat to safety, if possible, before using force. On the other hand, in many states there are "stand your ground" laws that remove the duty to retreat and allow a person to claim self-defense, even if they made no attempt to run away. [List of States].
Remember, even in "stand your ground" states, you can't claim you acted in self-defense if there was no reason for you to attack in the first place.