Is tooth whitening safe?

In general, yes.
The active ingredient in the bleaching agent for tooth whitening in home and dentist offices is carbon peroxide amide, which breaks down into hydrogen peroxide in your mouth. Research shows that this chemical does not increase the risk of oral cancer, which is an early concern. However, it can temporarily make the teeth more sensitive, with as little as 78% of white pearls lightened.
Your teeth become sensitive because the hydrogen peroxide in the whitening agent immerses in the softer layer of dentin through the protective outer coating of enamel, stimulating the nerve-rich dental pulp at the core. Micro cracks and leaks along the dental filling increase the likelihood of your teeth sensitivity. Up to 40% of people using whitening trays also experience temporary gum stimulation. It will disappear in a few days or up to a week or so.
Do not use teeth whitening bleach more than recommended times. Studies have shown that these products do wear away a small amount of enamel, which increases the sensitivity of the teeth and in rare cases can even cause tooth decay.