In linguistics, code-switching occurs when a speaker alternates between two or more languages, or language varieties, in the context of a single conversation. Multilinguals, speakers of more than one language, sometimes use elements of multiple languages when conversing with each other. Thus, code-switching is the use of more than one linguistic variety in a manner consistent with the syntax and phonology of each variety.
Code-switching is distinct from other language contact phenomena, such as borrowing, pidgins and creoles, loan translation (calques), and language transfer (language interference). Borrowing affects the lexicon, the words that make up a language, while code-switching takes place in individual utterances. Speakers form and establish a pidgin language when two or more speakers who do not speak a common language form an intermediate, third language. On the other hand, speakers practice code-switching when they are each fluent in both languages. Code mixing is a thematically related term, but the usage of the terms code-switching and code-mixing varies. Some scholars use either term to denote the same practice, while others apply code-mixing to denote the formal linguistic properties of language-contact phenomena and code-switching to denote the actual, spoken usages by multilingual persons.
In the 1940s and the 1950s, many scholars considered code-switching to be a substandard use of language. Since the 1980s, however, most scholars have come to regard it as a normal, natural product of bilingual and multilingual language use.
The term "code-switching" is also used outside the field of linguistics. Some scholars of literature use the term to describe literary styles that include elements from more than one language, as in novels by Chinese-American, Anglo-Indian, or Latino writers. In popular usage, code-switching is sometimes used to refer to relatively stable informal mixtures of two languages, such as Spanglish, Taglish, or Hinglish. Both in popular usage and in sociolinguistic study, the name code-switching is sometimes used to refer to switching among dialects, styles or registers. This form of switching is practiced, for example, by speakers of African American Vernacular English as they move from less formal to more formal settings. Such shifts, when performed by public figures such as politicians, are sometimes criticized as signalling inauthenticity or insincerity.