As with any country you visit for the first time, you need to be aware of the laws of the land and the general Do's and Don'ts.
The dress code in Iran is modern but modest (remember it's an Islamic Republic); and to ensure you have no problems and a stress-free holiday it's always good to follow these handy guidelines.
Dress code for women
The main thing here is that women should wear a headscarf at all times in public but don't let that put you off, on the contrary you will notice many Iranian women wearing beautiful, colourful and stylish headscarves. If you don't have an endless supply of scarves at home then don't worry as long as you bring a simple scarf for the first day then you can visit one of the many bazaars in Iran and pick yourself up some beautiful scarves at bargain prices.
Women should also cover their legs and arms and basically not show too much skin but again that doesn't mean it can't be relaxed. Many Iranians choose to wear jeans and long-sleeve shirts but like scarves they are very modern and colourful.
Many women wear colourful manteaus which are light jackets and fall just above your knees but you could also take light long-sleeve cardigans.
As you follow the basic steps in covering hair, arms and legs as mentioned you are fine to wear your normal western attire like leggings, jeans (no rips) and long sleeve tops.
You'll find that some cities dress more conservatively than others so just be vigilant and get a feel for how you wear your scarf, whether it is loosely resting on your hair or more fitted and whether the clothes you wear are tighter or looser.
Dress code for Men
There's not an awful lot of difference in what men wear around the world to what you can wear in Iran.
So jeans, shirts, t-shirts, hats and sandals all fine. You can wear three quarter trousers, however, it's frowned upon to wear shorts as they are not allowed unless you are at the beach.
Linen trousers are more comfortable to wear in the hotter months of Iran.