Unripe green tomatoes can contain glycoalkaloids, which are natural toxins that can irritate the gastrointestinal tract. This could cause symptoms such as vomiting and diarrhoea.
High levels of glycoalkaloids in tomatoes are associated with a bitter taste. So, if a tomato doesn't look ripe or tastes unusually bitter, it's best not to eat it. These toxins aren't present in ripe red tomatoes.