Yes, that's it's main purpose, and since the advent of ceramic tint there is also the advantage of it blocking heat.
When I wanted tint for my XTS, I did a lot of research on tint types and uva/uvb/radient and infrared heat. Ceramic tint blocks around 99% of UV and 80-89% of IRH. Regular carbon tint can make the interior of the car even hotter than without aftermarket tint. I saved the info and have pasted it below.
I went with 35% ceramic tint which means the final look is about 24.5% (70%x35%).
Keep in mind your area's tint laws, and if exceeding, I suggest getting an MD's note to avoid getting fined. I did not get the front windshield clear tinted, as the company said legally they cannot do it. When not out and about, my car is garaged out of the sun, so not such a big deal to not have it. When driving, the tint on sunroof, side and rear windows offers enough heat protection that the interior stays cool while driving with a/c. But not as much as when the sunshade is open - which really cuts down on the heat transfer. The UV protection was what really mattered to me.
“The harmful UV rays that reach the earth from the sun are divided into UVB and UVA,” explains dermatologist Dr. Michelle Levy. All of a car’s windows filter out the sun’s UVB rays, but not all windows will protect from all UVA rays.”
"The Pittsburgh Glass Works exec says windshields absorb 100 percent of UVB rays (which cause sunburn), and around 98 percent of UVA rays. Those UVA rays don't cause sunburn but can do long-term damage to the skin. That built-in protection gives windshields a sun protection factor - or SPF - of 50 or more, the equivalent of some of the strongest sunscreens. Sunroofs, too, often contain UV-absorbing technology that can block around 90 percent of UV rays. That's partly to keep the car cool as well as protect occupants from sun exposure. But side and rear windows are a different story, and their SPF can vary a lot depending on the vehicle. Side windows are usually made from cheaper tempered glass, which is around 4 millimeters thick and doesn't include a layer of plastic. Tempered glass is designed to shatter into tiny pieces in order to protect the occupants in a crash. But unless they're tinted for privacy, side windows usually absorb only 65 percent of UV rays. That gives them an SPF of around 16, the same as some of the lowest grades of sunscreen. Clear or tinted films can reduce the amount of total UV radiation penetrating the tempered glass by over 99%."