In most cases, tonsillitis is caused by a viral infection, such as the viruses that cause the common cold. In some cases, it is caused by bacteria named group A streptococcus. If the sore throat is due to a viral infection, the symptoms are usually milder compared to bacterial infection.
Tonsillitis is highly contagious. So try to stay away from people who have active infections to avoid any infections. Also, if you have tonsillitis, please to try to avoid passing the infection to others.