Phonetics is the study of how sounds are produced and perceived physically, while phonology studies how sounds work and combine mentally in languages. Phonemes are the smallest units of sound that can distinguish words in a language, such as the vowels in "pin" and "pen" or consonants in "pet" and "bet". Phonology also examines how phonemes change and contrast to impact meaning. Dialects vary languages in pronunciation as well as vocabulary and grammar, while accents only differ in pronunciation.