We don't have an official dress code at my lodge, but we do have an understood standard of dress. We have turned people around at the door when they showed up wearing shorts. If someone showed up wearing jeans and a t-shirt, it would be pretty evident to them in a hurry that we have a standard of dress because they would stick out like a sore thumb. When people have said they didn't want to visit our lodge because they felt out of place or whatever because of how we dress, I tell them I'm sorry they feel that way, but I will still visit their lodge ... and I'll be wearing a suit.
I know of a couple of lodges that have voted in a coat and tie dress code. They went to Goodwill and bought a bunch of used jackets and ties. If someone shows up improperly dressed, they are given one for the night. If they don't want to wear it, they don't come in.
As a member of the GL Education Committee, one of the things we tell people about dress codes is this: Let's say you are going to lodge and you are wearing the same old clothes you wear to work every day, or even worse, the same clothes you wear to Walmart or to mow the yard; if you stop at the store or to get gas and someone sees you, they aren't likely to ask what you are doing, but if they do, is it going to give them a favorable impression of Freemasonry? On the other hand, if you are wearing a suit or coat and tie and they ask you where you are going, when you tell them, their natural reaction will be "That must be important."
There was a time when Masonic Lodges were important parts of communities. If its own membership doesn't think it's important enough to take the time to clean themselves up a bit, why would the general public? Just because society has devolved to the point where people think it's OK to dress like slobs, that doesn't mean Freemasonry should. We should be the example.