Solvent:
The SN2 reaction acts best in polar aprotic solvents (that is solvents with a high dipole moment, but without O-H or N-H groups). These include solvents like acetonitrile (CH3CN) or dimethylformamide (DMF). These solvents are polar sufficient to dissolve the ionic reagents needed for nucleophilic substitution, but they do so via solvating the metal cation in place of the anion. Anions are solvated by hydrogen bonding and because the solvent is not capable of hydrogen bonding, the anions remain unsolvated. Such types of 'naked' anions retain their nucleophilicity and react much more strongly with electrophiles.
Polar, protic solvents like water or alcohols can as well dissolve ionic reagents but they solvate both of the metal cation and the anion. The result of it is, the anion is 'caged' in by solvent molecules. This stabilizes the anion, formulates it less nucleophilic and makes it much less likely to react by the SN2 mechanism. As a result, the SN1 mechanism turns into more significant.
The SN1 mechanism is specifically favored while the polar protic solvent is as well a non basic nucleophile. Hence, it is most likely to take place while an alkyl halide is dissolved in water or alcohol. Protic solvents are bad for the SN2 mechanism because they solvate the nucleophile, but they are extremely good for the SN1 mechanism. This is since polar protic solvents can stabilize and solvate the carbocation intermediate. If the carbocation is stabilized transition state directing to it will as well be stabilized and this ascertains whether the SN1 reaction is favored or not. Protic solvents will as well solvate the nucleophile by hydrogen bonding, but not like the SN2 reaction, this does not influence the reaction rate because the rate of reaction is independent of the nucleophile.
Nonpolar solvents are of no utilize in either the SN1 or the SN2 reaction because they cannot dissolve the ionic reagents needed for nucleophilic substitution.