From Baidu:
老外,是中国人对国外人的一种俗称,类似与老张、老王、老李之类的称呼。称呼中加“老”显得亲热,比如“老乡”“老表”,称呼你老外,就像称呼老张老李那样,大大咧咧,随便亲切。过去中国人对外国人的称呼都是用在第三人称上,只有“老外”可以用于第二人称。
To translate, it says laowai is a colloquial term for foreigners, similar to nicknames such as laozhang and laowang. The word lao is added to sound friendly. In the past, Chinese used terms that address foreigners as third persons, the term laowai can be used on a second person.
From Wikipedia:
Laowai is a commonly used Chinese mandarin word. It is the shortened, informal version close to wàiguórén 外国人 ("foreigner"), a better translation of Laowai would be "alien"... So Laowai 老外 is more of a neutral term which can be used as: "an obvious foreigner", "very exotic", or "adventive", "alien".
Based on the above, there are two lines of thought: one saying that 老 is added as an indication of friendliness to foreigners; another saying that 老 is added to indicate that a foreigner is "always" an outsider.
Does anyone know the exact origin of this term?
老外is similar to外国佬. And佬is not a polite address. Besides, I don't know老外can be used on a second person. But老外is not so impolite as外国佬. It's not derogatory sometimes. However, it never means kind. This term is used as other meanings first. But the origin of foreigner is vague and hard to know. – halfelf Nov 17 '12 at 15:09老外is totally different from "alien". Baidu this time gives the right answer.老外just describes one who is foreigner, with much friendliness. – Mike Manilone Nov 17 '12 at 15:47外国人or any other friendly words, all老外. Search this term on Baidu and Google both. See the results you get.老外is only used in negative or neutral situation. There's none friendly. – halfelf Nov 18 '12 at 00:59老外is a modern word of the ancient夷. There's something racist in the culture. And an important evidence is that老外only refers to caucasian. Usually we won't call other foreigners老外. – halfelf Nov 19 '12 at 02:16