From the beginning of Doctor Who, the companions have been one of the most important aspects of the show. They not only provide the viewer with a character to relate to, but more importantly they provide the ultimately (or at least, usually) human soul to the series. In part because there have been so many companions, there isn't a universally agreed upon definition of who and what a companion is. There have been many characters that functioned in the "role" of a companion, but who doesn't fit as a companion in this list. That is expected.
In my definition of a companion, the character MUST satisfy these two rules:
First, they must travel with the Doctor in the TARDIS. This eliminates characters such as Liz Shaw that worked with the doctor over multiple serials but never traveled with him.
Second, they must do this over multiple serials (in the original series) or in multiple, non-linked, episodes (for the revised series).
Other sites generally use a similar list, but these rules provide the least amount of ambiguity. It leaves out Liz Shaw and the UNIT staff (from the Third Doctor's era, while he was exiled to Earth) because they didn't travel in the TARDIS or didn't travel over multiple serials. It leaves out characters that traveled in the TARDIS during a single serial or whose travels were unusual or forced. (For example, the UNIT staff during the "Three Doctors" and Jackie Tyler during "Army of Ghosts".) And finally, it leaves out characters such as Sara Kingdon (from "The Dalek's Master Plan") and Astrid Peth (from "Voyage of the Damned") who functioned as companions during a serial/episode, but didn't stay on for longer.
By these rules, the Doctor has had the following 32 companions:
Susan Foreman, the Doctor's granddaughter
Ian Chesterton, Susan's schoolteacher from the 1960s
Barbara Wright, another of Susan's teachers from the 1960s
Vicki, an Earth teenager from the 25th century
Steven Taylor, a Earth spaceship pilot from some point in the future
Katarina, a handmaiden from Ancient Greeze (circa 1200 BCE)
Dodo Chaplet, another Earth teenager from 1966
Polly, a secretary from Earth 1966
Ben Jackson, a Seaman from the British Royal Navy in 1966
Jamie McCrimmon, a Scottish piper from 1746
Victoria Waterfield, daughter of a scientist from 1866
Zoe Heriot, a teenage genius and librarian from a Earth space station in the 21st century
Jo Grant, a UNIT soldier from the 1970s/1980s
Sarah Jane Smith, a young journalist from the 1970s/1980s
Harry Sullivan, a UNIT medical doctor from the 1970s/1980s
Leela, the primitive/tribal descendant of an crashed Earth ship in the far future
K9, an intelligent robot dog
Romana, a young female Time Lord
Adric, a brilliant teenage mathematician from a planet in E-Space
Tegan Jovanka, a airline stewardess from 1981
Nyssa, daughter of an aristocrat from the planet Traken
Vislor Tourlough, a political exile to Earth from the planet Trion
Kamelion, a shape-changing andriod
Peri Brown, a college student from 1984
Mel Bush, a computer programmer from the 20th century
Ace, a teenage waitress/pyromaniac from the 20th century
Rose Tyler, a shop clerk from 2004.
Adam Mitchell, an extraterrestrial researcher from 2012
"Captain" Jack Harkness, a former Time Agent from the 51st century
Micky Smith, a mechanic and Rose's boyfriend
Martha Jones, a medical student from 2006
Donna Noble, a secretary from 2007
Note that K9 and Romana have traveled with the Doctor under multiple "incarnations". (K9 was rebuilt, but with his memories intact, and Romana regenerated in the Time Lord style.) They are only listed once here since they remain the same character.
Several other characters have played the role of a companion, either for a single storyline or without traveling with the doctor in the TARDIS:
Sara Kingdom
Liz Shaw
Astrid Peth
Donna Noble would also have fit in this category, until her return in "Partners in Crime".
