A grammatical morpheme that must be attached to a host word of an appropriate kind.
An affix cannot stand on its own as an independent word, so it need a host to attach to. An affix which attaches to the beginning of a word (e.g. un- in unhappy) is called a prefix: an affix which attaches to the end of a word (e.g. -s in chases) is called a suffix.
Each affix has a limited set of word categories to which it can attach. For example, in English, the suffix -ed marks the past tense and thus, can only be attached to verbs. Likewise, the prefix anti- (as in antivirus) can only be attached to nouns.