Although there is no formal dress code in the sense that you won't be let in without a tie, you will for sure get better service and experience less arrogance and grumpiness if you dress up a little. You'll find that the locals are generally nicely dressed, women in dresses/skirts and high heels, men in tuxedos, and not as casual as tourists. You are free to wear whatever you like, but often sneakers and jeans aren't looked well upon.
Austrians are generally casual dressers, although a jacket and tie is usually worn to exclusive restaurants and smart clothing is definitely the norm for a night out to the theatre or opera. (photo: the gold leaf curtain in the Opera House).