In linguistics, code-switching is the concurrent use of more than one language, or language variety, in conversation. Multilinguals—people who speak more than one language—sometimes use elements of multiple languages in 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). 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 said language-contact phenomena, and code-switching to denote the actual, spoken usages by multilingual persons.

In the 1940s and 1950s, many scholars called code-switching a sub-standard language usage. Since the 1980s, however, most scholars have recognised it is 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 which include elements from more than one language, as in novels by Chinese-American, Anglo-Indian, or Latino/a writers. In popular usage code-switching is sometimes used to refer to relatively stable informal mixtures of two languages, such as Spanglish or Franponais. Both in popular usage and in sociolinguistic scholarship, the name code-switching is sometimes used to refer to switching among dialects, styles or registers, such as that practiced by speakers of African American Vernacular English as they move from less formal to more formal settings.