Layover Visa Kenya

Hello,
I'm going to be traveling to Tanzania, but I have a layover in Kenya. Does anyone know if I need to get a visa, and what kind? I have heard of transit visas, but I read that's for going around Nairobi. I'm not planning on leaving the airport, do I still need one?
Thanks!

It depends upon whether you are staying airside or not.  If you need to pass through immigration and collect your bags, then check in for your next flight, you must buy a transit visa ($20), which is valid for 72hrs.  If your bags have been checked through and you do not go through immigration, then a visa is not required.

Thanks! Our bags are checked and we'll just board the next flight.

If things change, are we able to buy the visa onsite?

Yes you can.

Thank you!