Most nationalities can get a visa valid for 3 months, on arrival at the border for a fee of US$50 to US$200.
Nationals of the following countries do not need a visa: Antigua & Barbuda, Anguilla, Ashmore & Certie Island, Bahamas, Barbados, Bermuda, Belize, Brunei, British Virgin Island, British Indian Ocean Territory, Botswana, Cyprus, Cayman Island, Channel Island, Cocoas Island, Cook Island, Christmas Island, Dominica, Falkland Island, Gambia, Ghana, Gibraltar, Grenada, Guernsey, Guyana, Heard Island, Hong Kong, Isle of man, Jamaica, Jersey, Kenya, Kiribati, Lesotho, Malawi, Montserrat, Malaysia, Madagascar, Malta, Mauritius, Macao, Mozambique, Nauru, Niue Island, Norfolk Island, Namibia, Papua new Guinea, Rwanda, Romania, Ross Dependency, Samoa, Seychelles, Singapore, Swaziland, Solomon Island, St. Kitts&Navis, St. Lucia, St. Vicent, St. Helana, South Africa, South Sudan, Trinidad & Tobago, Turks & Caicos, Tokelan, Tonga, Tuvalu, Vanuatu, Uganda, Zambia and Zimbabwe
The following nationalities cannot get a visa on arrival:Afghanistan, Azerbaijan, Bangladesh, Chad, Djibouti, Ethiopia, Eritrea, Equatorial Guinea, Nigeria, Pakistan, Kazakhstan Republic, Kyrgyzstan Republic, Lebanon, Mali, Mauritania, Niger, Palestine, Senegal, Iraq, Iran, Somalia, Sri Lanka, Somali land, Sierra Leone, Tajikistan, Turkmenistan, Uzbekistan and Yemen.
If your nationality is not listed above you can probably obtain a visa at the border or get an e-Visa.
Tanzania e-visa
Tanzania visa information
Tanzania Embassies