When you accidentally spill some salt in your sugar, it can be difficult to tell which is which. On the molecular level, however, there are multiple differences between salt and sugar crystals. The crystals that these two molecules can form are actually quite beautiful when experimented upon and have been used to teach the concept of molecular shape in science classes.
The shape of salt crystals is a six-sided cube similar to a dice. Sugar crystals on the other hand resemble a hexagonal prism. The edges of sugar crystals are often more sharp. The shape of sugar crystals can be estimated from looking at a piece of rock candy, which consists of many sugar crystals grown and bonded together. Occasionally, salt and sugar will look similar under a microscope, but this is typically because of broken or bonded crystals.
Salt takes on a cube-like shape because of the way that its molecules are bonded together. The ionic bonds of salt are very specific requiring one metal and one non-metal and this causes the molecule to be arranged in a regular and repeating crystal. Similarly, the shape of a molecule of sugar is similar to a hexagon, but since it is not as particular about its bonding, this leads to sharper edges and a less regular shape.
The color of salt and sugar crystals is also slightly different though they both look similar when viewed without a microscope. Sugar crystals tend to be sparkling and clear. Salt crystals are duller and have a sort of frosted or white color. The taste difference between the two crystals is the most easily discernible trait that sets the two crystals apart.