Listen to fugues to get a sense of what a finished fugue sounds like. To get a sense of a fugue, visit the Well-Tempered Clavier website (see Additional Resources), which plays recordings of Bach's Well-Tempered Clavier fugues while scrolling through his scores.
Compose the main melody of the fugue, called the "subject."
Invent an "answer" to the subject for the second voice to play or sing immediately after the first voice finishes the first statement of the subject. The answer often stays in the same key as the subject, but begins a fifth higher, or transposes the key to the dominant key of the subject.
Harmonize the subject and answer and write the harmony out into separate melodic lines, so that each voice continues to play once a new voice enters. Add any non-essential notes you see fit, to increase the musical interest.
Introduce each melodic line one at a time and give the subject to each voice.
Finish the exposition by giving the subject to the last voice.
Write a development section that explores motives from the exposition. Fragment or modify parts of the subject through modulation, inversion, augmentation or diminution or by other techniques, and gradually bring the development back to a restatement of the subject.