From Bulbapedia, the community-driven Pokémon encyclopedia.
Same-type attack bonus, commonly abbreviated as STAB, is a 50% boost to the power of an attack when the attack is the same type as one of the types of the Pokémon using the attack. This results in a 50% increase in damage (100% if the Pokémon has the Adaptability Ability).
Same-type attack bonus does not apply to moves that do not use the normal damage formula, such as Seismic Toss.
The same-type attack bonus was introduced in Generation I and has remained unchanged since.
Example of attack bonus
A Blastoise using Surf increases the power of the move by 50%, from 90 to 135, since both Blastoise and Surf are Water-type. However, a Blastoise using Ice Beam does not receive an increase in special attack power of the move, since Blastoise is not an Ice-type Pokémon.
A Lapras, on the other hand, would receive the same-type attack bonus when using either Surf or Ice Beam, since Lapras is both Water-type and Ice-type.
Due to Protean activating before a move's execution, the user will always receive a same-type attack bonus on every move used, regardless of the move's type.
Variable type moves
A Pokémon only receives the same-type attack bonus on the current type of the move, not its listed type. For example, if the user's type matches their Hidden Power type, they do receive same-type attack bonus; however, since a Normal-type Hidden Power is not possible, a pure Normal-type Pokémon cannot receive the same-type attack bonus for Hidden Power, unless they have the Ability Normalize.