Understanding yourself / 11 min read / November 2, 2026

Code-switching in text messages: what the thread keeps

John Gumperz defined conversational code switching in 1982. In a chat the switch stays in the record, two languages or scripts side by side, which makes it countable but not explained.

Three chat bubbles on a dark background, each split by a dotted line between two differently coloured bars of text, illustrating the article Code-switching in text messages: what the thread keeps.

Code-switching in text messages is the written form of what John Gumperz, in Discourse Strategies (1982), called conversational code switching: passages from two grammatical systems placed side by side in one exchange. In speech the switch is heard and gone. In a chat it stays in the record as two languages or two scripts next to each other, often inside one message, which is why researchers have been able to count it.

People search the phrase when a thread with a friend, a parent or a partner runs in two languages at once and they want to know whether that has a name. It does, and it has a literature. This page follows the definition into the written record, through three studies of real text messages, and stops where a count of switches stops being able to say anything.

Gumperz and two grammatical systems in one exchange

John J. Gumperz, of the University of California, Berkeley, gave the idea its working definition in chapter 4 of Discourse Strategies, published by Cambridge University Press in 1982. The chapter summary on Cambridge Core opens with it: “Conversational code switching can be defined as the juxtaposition within the same speech exchange of passages of speech belonging to two different grammatical systems or subsystems.”

Two parts of that sentence matter for a chat. The first is “within the same speech exchange”. The switch happens inside one conversation, between people who are talking to each other, not across two separate settings. The second is “systems or subsystems”. The definition is written to reach past two named languages, although every example in the summary is a pair of languages.

The summary says the alternation most often takes the form of two sentences in a row, as when a speaker uses a second language either to reiterate a message or to reply to someone else’s statement. Its examples come from natural talk recorded in bilingual communities, in three language pairs: Spanish and English, Hindi and English, and Slovenian and German. The speakers, it says, are fluent in both languages and regularly use both in their daily routines.

The first example is Chicano professionals in California saying goodbye. One says “Well, I’m glad I met you.” and follows it with “Andale pues”, glossed in the book as “O.K. swell”. Two sentences, two languages, one leave taking.

The full chapter runs to pages 59 to 99 and sits behind a paywall. Everything said about Gumperz on this page comes from the public summary and its examples, not from the parts of the chapter that summary does not show.

A switch you hear becomes a switch you can point to

Gumperz’s material was recorded talk. A switch in speech arrives as sound and is over before anyone can look at it again. To study it, someone first has to record it and write it down.

A chat skips that step. The person typing has already written the switch down, in whatever spelling and alphabet they chose, and the thread keeps it in order with a name and a time beside it. Scroll back a year and the “Andale pues” of a typed goodbye is still there, in the same position relative to the sentence before it.

That changes what can be done with it. A switch that sits in a file can be found, pointed at and counted, by a person reading or by software. The three studies below are each, in their own way, a use of that fact. None of them could have been done the same way from memory of conversations.

345 Swiss text messages, mostly French, rarely only French

Simona Pekarek Doehler’s 2011 paper in Linguistik Online, volume 48, issue 4, has the title “Hallo! Voulez vous luncher avec moi hüt?”. According to the article’s abstract, it analyses the forms and functions of code-switching in 345 SMS messages from Switzerland whose base language is French.

The abstract reports that the people writing these messages regularly code-switch even when they are not members of a bilingual speech community. That is a step away from Gumperz’s speakers, who were fluent in both languages and used both every day.

The most frequent form was the insert: a single item, or a short combination of items, embedded in a message written in another language, typically drawn from a limited range of routinised expressions. English was the language most often switched into. German, Swiss German, Spanish and Italian also recurred, and the abstract ties Spanish and Italian in particular to terms of endearment.

On function, the abstract says code-switching regularly highlights actions with a strong interpersonal, phatic focus, such as greetings, goodbyes and thanks, and is associated with the expression of affection. Gumperz’s first example was a goodbye too, recorded in speech and published 29 years earlier.

Counting every switch in 30 Lebanese WhatsApp groups

Ayman Halawi, Nasri Messarra and Jarjoura Hardane, of Saint Joseph University of Beirut, took the countable record as far as it goes. Their 2022 paper in the Canadian Journal of Applied Linguistics, volume 25, issue 2, defines code-switching for the purpose of the study as “a switch from one written code to another within the same message”, as stated in the abstract on the journal’s site.

Over 14 months they collected 168,219 messages from 30 WhatsApp groups, written by 1,482 bilingual students at seven Lebanese universities. They built a tool, which they call DACA, to detect code-switching and Arabizi automatically, and ran it over the whole set.

The abstract reports 15,342 occurrences, or 9.1 per cent of all messages. Of those occurrences, 70.5 per cent were in messages written in Arabizi, 17.9 per cent in messages in English, 10.6 per cent in messages in Arabic and 1 per cent in messages in French. Switches inside an Arabizi message went towards English in 91.3 per cent of cases, and switches inside an English message went towards Arabizi in the same proportion.

Every one of those figures depends on the switch being written down. A spoken corpus of that size would need transcribing before a single switch could be counted. Here the participants had already done the transcription by typing.

The figures describe group chats among university students in Lebanon over 14 months. They are not a rate for text messaging in general, or for any other community, and the abstract does not present them as one.

Arabic in Latin letters, and why software labels each word

Arabizi is the name for Arabic written in the Roman alphabet. Safaa Shehadi and Shuly Wintner described a corpus of it at the Seventh Arabic Natural Language Processing Workshop in 2022, pages 194 to 204 of the proceedings. Their paper’s abstract in the ACL Anthology describes social media posts in which Arabizi is mixed with other languages, notably English, French, and Arabic written in Arabic script.

They annotated a subset of those texts by hand with a language label on every word, and the abstract calls that a non-trivial task because of the nature of mixed language writing, especially on social media. They then trained classifiers to predict the labels, extended the word level predictions to find sentences that contain Arabizi and code-switching, and applied them to the raw corpus to build a much larger dataset.

The word level is the point. In a typed message the unit of a switch can be one word, and the boundary between two codes is not always marked by a change of alphabet. When Arabizi and English share the Latin alphabet, telling them apart takes a decision about each word, which is what the hand labelling and the classifiers supply.

Three kinds of switch a thread makes visible

Put the three studies next to Gumperz’s definition and a chat thread can show at least three kinds of switch, each of which leaves a different trace.

A switch of script is the easiest to see. Arabic in Arabic letters next to English in Latin letters is visible at a glance, without reading a word of either, and Shehadi and Wintner’s corpus mixes exactly those.

A switch of language inside one script needs reading. The Swiss inserts are English or Italian words dropped into a French message, all in the same alphabet. Nothing in the shape of the text marks them; a reader, or a classifier, has to recognise the words.

A switch of spelling for the same language sits between the two. In Halawi and colleagues’ count, Arabizi and Arabic appear as separate codes, so Arabic typed in Latin letters and Arabic typed in Arabic letters are not the same code for the purpose of the tally. Speech has no equivalent of that choice, because nobody pronounces an alphabet.

One kind of switch belongs to a different subject. Moving into the other person’s language or way of speaking, so that two people end up closer together, is the territory of communication accommodation theory, measured across 215,000 conversations, and the small shared words are covered in language style matching. Code-switching as Gumperz defines it does not need a second person to move towards; one writer can switch inside their own message.

What a tally of switches leaves unexplained

A count says where switches are and how many there are. It does not say why any one of them happened. Gumperz’s summary names reiterating a message and replying to someone else as common shapes of a switch, and telling which one a given switch is takes the sentences around it, not the fact of the switch alone.

The functions in Pekarek Doehler’s abstract, greetings, thanks, affection, are findings about the 345 messages she analysed. They describe what switching did in that set. They do not turn every Italian word in a French message into an endearment, and the abstract does not claim they do.

Automatic counts carry their own limit. Halawi and colleagues’ figures are what their DACA tool detected, and Shehadi and Wintner say plainly that even hand labelling mixed language writing is hard. A switch the tool did not recognise is not in the number.

Each sample is also narrow in its own way: one base language in one country, students in one country, posts from social media. A thread between two people in a different pair of languages is outside all three. The piece on reply speed across ten languages runs into the same problem from another direction, and what a chat analysis cannot tell you about someone sets out the general version.

Portraitor’s home page says “We analyse language patterns, not people.” Its sample report opens with a line that reads “Detected languages: English”, and at step two it asks you to pick one person, saying their messages are read while everyone else stays context. The home page does not say how a thread that switches between languages is read, and this page does not fill that gap. Chat analysis in another language goes through everything the published pages do say on the subject, and analysing your own messages covers picking your own side of a mixed thread.

Frequently asked questions

Frequently asked questions

What is code-switching in text messages?

It is moving between two languages, or two written codes, within one conversation or one message in a chat. John Gumperz defined conversational code switching in 1982 as passages from two grammatical systems or subsystems placed side by side in one exchange, and studies of SMS and WhatsApp apply the same idea to typed messages.

Is dropping an English word into another language code-switching?

Yes, researchers count it. In Simona Pekarek Doehler’s 2011 study of 345 French based Swiss text messages, the commonest form of code-switching was the insert, a single item or short combination embedded in a message in another language, and English was the language most often inserted.

Is writing Arabic in Latin letters a kind of code-switching?

Arabic in Latin letters is called Arabizi, and some studies count it as its own code. In a 2022 study of 168,219 Lebanese WhatsApp group messages, Arabizi and Arabic were counted separately, and 70.5 per cent of the switches found were in messages written in Arabizi.

How common is code-switching in group chats?

It depends on the community, and the only figure here is for one. Across 30 WhatsApp groups of Lebanese university students over 14 months, an automatic tool found code-switching in 9.1 per cent of messages. That figure does not carry over to other languages or other groups.

Can a chat analysis tell why someone switched languages?

Not from the switch alone. A count shows where switches sit and how often, but the reason for any one of them depends on the surrounding messages, and the studies on this page report functions for their own samples only. Portraitor’s home page does not say how it reads a thread that mixes languages.

A switch in a chat is written down by the person who made it, which makes it easy to count and no easier to explain.

Where we come in

Your conversations, read the way you would read someone else’s.

Portraitor takes a chat export you already have, anonymises it in your browser, and returns a structured reading of how you come across. Identifying details are removed in your browser before anything is sent.

See how it works →
Sources
  1. Gumperz, J. J. (1982). Conversational code switching. In Discourse Strategies, chapter 4, pp. 59 to 99. Cambridge University Press.
  2. Pekarek Doehler, S. (2011). Hallo! Voulez vous luncher avec moi hüt? Le «code switching» dans la communication par SMS. Linguistik Online, 48(4).
  3. Halawi, A., Messarra, N., & Hardane, J. (2022). La fréquence de l’alternance codique dans les groupes WhatsApp des étudiants libanais. Canadian Journal of Applied Linguistics, 25(2).
  4. Shehadi, S., & Wintner, S. (2022). Identifying code-switching in Arabizi. Proceedings of the Seventh Arabic Natural Language Processing Workshop (WANLP), pp. 194 to 204.
  5. Portraitor home page, the sample report and step two of the flow.