Is it better to wear formal clothes for a PhD or MSc thesis defense or can we wear something as simple as a T-shirt?
Almost anything will be fine, provided you feel comfortable on them. The clothes you are wearing will influence the first impression, but you are going to be talking about your project for at least 20 min, and the confidence and clarity will wipe whatever the first idea was. Make sure they are you feel good on them, and don't use them for the first time this day in case they itch or something (specially important for underwear!).
The right level of formalism is very dependent on the culture and setting, but it is probably not so important. It will also depend on whether the event is public or not: if the audience are going to be the people that have been seeing you in normal clothes all year round, or if the public is going to attend and the University wants to shine. Of course, a frock and a top hat or just a swimming suit will look ridiculous, but anywhere in the middle would work.
For reference, I have been present to two PhD defences in Sweden (where they are quite lax in formalities). In one, the doctorand was wearing plain business-like clothes, slightly more formal than a normal day; in the other, he was wearing a normal shirt, quite less formal than his normal attire. And, for the record, both passed.
Edit: Jigg is right in pointing that some universities do require a certain dress code. In this case, it will probably be clearly stated by the centre. Being rejected is possible, but extremely unlikely, as it can get the university in all sorts of legal troubles. Also, these regulations can get to absurd levels (the story seems to be a legend, but the third comment may be legit).
Think of it as a job interview, but actually much more important than that. There is such a thing as unconscious bias - first impressions count and you should therefore aim to make a good one. If you look professional, then they will think you are professional, and are more likely to trust and believe in you. It may not be fair, but that is how it is. I recommend being smartly dressed.
In job interviews it's actually a mistake to dress up fully formally for jobs (like software) that don't require it. Your grad student culture has a range probably from t-shirts to business casual.
I do think it's important to say, "Hey, I'm taking this seriously, this is a serious occasion, and I'm prepared." Comfort is the other important thing.
In one sentence, wear something in the top third of your wardrobe, but not in the top tenth. Smarter/sharper is good, fancy pants dinner or gala attire is bad.
That being said, here's my attempt at male fashion advice (sorry, I can't really help the women here too much) if you really do feel like a more detailed breakdown will help you.
- Street shoes (c.f. sneakers)
- dark wash jeans or slacks
- collared shirt tucked in, or similar such as nice sweater
- neatly shaven to your level of grooming (beard or clean okay, just whatever you wear)
- not looking like you "need a haircut" but don't get a fancy or special haircut. Wear your normal accessories, whether it be watch or necklace.
- If tattoos are part of your look they've got you this far, don't worry about covering them or not ("within reason").
- Try not to look like a sloppy student who never dresses up: wear clothes straight from the cleaner.
- A tie if you like, in my mind I picture that as a nice addition but not necessary.
I think a jacket is too much: it will make you look too "other" compared to the professors. If you over-dress you will make yourself look "on the spot" more than you already are, and who wants that?
This might sound too analytical for fashion (unless you're really into fashion in which case it sounds fun!), but this shouldn't sound daunting. Just dress normal, normal, normal, nice.
You can wear something as informal as a t-shirt and, as others have said, it probably won't swing the decision one way or another. I've seen very informal defense dress from passing students. That said, most people dress up at least slightly more formally than normal and many wear business attire. If you're extremely uncomfortable or resistant to dressing up, don't worry too much. Otherwise: Why not?
Showing up wearing a suit and tie or similarly formal business attire is a strong signal that you are taking the defense seriously. Although they're not everything, first impressions matter and formal dress can also help you look (and feel) authoritative, knowledgeable, and a way you can show that you've taken the time to be prepared.
I am extremely casual on a day-to-day basis but I wore a suit for my defense. Although my own advisor teased me that my defense was the first time he'd seen me dressed up, the fact that he knew that I rarely dressed that way made it very clear how seriously I took the process. Would I have passed anyway? Sure. But even if the effect is one person challenges you a little bit less in the Q&A, that could be worth it.