From Bulbapedia, the community-driven Pokémon encyclopedia.
Same-type attack bonus (Japanese: タイプ一致ボーナス coincident type bonus), abbreviated STAB, is a 50% damage boost of an attack when it 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. Contrary to what some early strategy guides stated, Normal-type attacks can receive the same-type attack bonus.
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.
If Protean is activated 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. The same is also true for Fairy-type.
In Pokémon GO, STAB boosts damage by 20% (25% prior to June 21, 2017).
In other languages