The Difference Between Butterflies and Moths
Butterflies and moths are arthropods categorised in the animal kingdom class Insecta, in the order Lepidoptera. There are two suborders, butterflies are Rhopalocera and moths are Heterocera. Although distinct differences exist between most butterflies and moths, there are exceptions to every example and it is difficult to be definitive.
Deciding what an unknown subject is, butterfly or moth, depends on species. Behavioural traits and appearance help but there are some butterflies that behave and look like moths and some moths that behave and look like butterflies.
By far the most reliable way is to first identify the species and then consult published documentation that gives information on species and whether it is Rhopalocera or Heterocera.
Below is a broad guide which gives a reasonable chance at coming to the right conclusion.

Illustration of some of the main differences in butterfly and moth anatomy
Credit: Mrice20 - Own work, Open access, CC BY-SA 4.0
Antennae
Butterflies usually have thin antennae resembling a pair of single hairs protruding from the head. Most often their antennae culminate in a club like structure furthest from the body. Moths usually have feathered or tapering antennae without the club like structure. There are exceptions.
Wing Posture
When resting butterflies usually fold their wings closed and hold them upright above their bodies. Moths most often lay their wings back against their bodies, forming a tent-like shape. Species do exist in both suborders that do the opposite.
Bodies
Butterflies tend to have long, slender bodies. Normally, moth bodies are short and wide. Most moths are more densely covered in setae than butterflies are, a substance that resembles fur although it isn't actually fur and evolved separately. Again, there are exceptions.
Behaviour
Most butterflies are diurnal, flying during daylight hours. Most moths are nocturnal, flying at night. Most is the key word here, not all.
Colouration
Broadly, butterflies are the more colourful of the two suborders. Butterfly colouration and patterning has generally evolved to either attract a mate or help protect from predation. Because moths tend to fly at night and rest during the day, muted colours have evolved as a form of camouflage. Again, there are exceptions.
The Frenulum and Retinaculum
Perhaps the most reliable method of determining whether an unknown subject is a butterfly or a moth is to examine if it possesses a frenulum and retinaculum which are absent in butterflies but exist in moths. They are structures on the wings consisting of a spine on the hindwing and a loop on the forewing. Together they form a kind of latch that prevents the hindwing riding over the forewing. Examination is of course not an easy task and is normally only undertaken by professional entomologists or lepidopterists with the right skills and facilities.
As usual there are exceptions. The Australian butterfly species Euschemon rafflesia (Regent Skipper) is the only true butterfly species to possess a frenulum and retinaculum. They are also represented in the hedylidae (moth-butterflies found in the Americas) which form a separate family within Lepidoptera.
So, in conclusion, what is the difference between butterflies and moths? It's not an easy question to answer definitively and is of little scientific consequence anyway within the order Lepidoptera.
______
That is the end of my article but I would like to add a thought or two. I don't quite understand why science and society in general wish to separate butterflies and moths, especially when there are no clear or absolute differences between the two suborders anyway, with so many physical and behavioural anomalies. Is it just a historic thing? Does it really matter if a given species within Lepidoptera is labelled as a butterfly or a moth? If it does matter, what is the reason? To me, the most beautiful 'butterfly' in the world, Chrysiridia rhipheus is in fact a moth (Madagascan Sunset Moth). Any thoughts on this?
Cheers,
Phil.