How to Search Tweets by Language

To search tweets in one language on X, add lang: and the two-letter language code to your query, for example football lang:es for posts in Spanish.

Cover card reading 'How to Search Tweets by Language on X'

To search tweets in one language on X, add lang: and the two-letter language code to your query, for example football lang:es for posts in Spanish. X detects each post’s language automatically. You can also pick a language from the dropdown in the Advanced search form.

Language filters are essential for regional research and for cutting noise from global topics. lang: sits with the word operators in the Twitter advanced search operators reference. This guide is one of the techniques in how to search tweets by keyword.

How Do You Filter X Search by Language?

You filter X search by language by adding lang: with an ISO language code, or by choosing a language under Words in the Advanced search form. X’s advanced search lets you search posts in a specific language (X Help Center). Listed below are the 3 steps.

  1. Type your keyword and the language code: elections lang:de.
  2. Press Enter.
  3. Open Latest for every match.

Common X Language Codes

X uses two-letter ISO 639-1 codes for most languages. Listed below are 12 common ones.

Language Code Example
English en ai lang:en
Spanish es ia lang:es
Portuguese pt futebol lang:pt
French fr élection lang:fr
German de wahl lang:de
Italian it calcio lang:it
Turkish tr deprem lang:tr
Arabic ar كرة lang:ar
Japanese ja 地震 lang:ja
Korean ko 축구 lang:ko
Hindi hi क्रिकेट lang:hi
Indonesian in banjir lang:in

Indonesian uses in on X rather than the ISO code id (twitter-advanced-search reference).

What Are X’s Special Language Codes?

X has special language codes for posts with no detectable language, such as posts that contain only hashtags, links or media. Listed below are the 7 special codes (twitter-advanced-search reference).

Code Finds posts that contain
lang:und Text in an undetermined language
lang:qam Only mentions
lang:qct Only cashtags
lang:qht Only hashtags
lang:qme Only media links
lang:qst Very short text
lang:zxx Only media or a link card, with no text

How Do You Search Several Languages at Once?

To search several languages, group the codes with uppercase OR: topic (lang:es OR lang:pt). To exclude a language, negate it: topic -lang:en. OR searches are covered in how to search multiple keywords on X with OR.

Why Does a Language Filter Miss Posts?

A language filter misses posts because X detects language automatically, and short or mixed-language posts are often classified wrongly or as undetermined. Add OR lang:und to catch unclassified posts, or search a keyword that only appears in the target language.

How to Collect Posts in One Language With apidojo

apidojo’s Tweet Scraper V2 on Apify has a tweetLanguage input that applies the language filter for you, so a dataset contains posts in one language only. The actor documents this with a keyword example in English (Apify).

{
  "searchTerms": ["artificial intelligence"],
  "tweetLanguage": "es",
  "sort": "Latest"
}

It costs $0.40 per 1,000 tweets. Language-filtered datasets are covered in how to collect tweets for sentiment analysis, and the full product is the apidojo Twitter Scraper.

Questions people ask

Does lang: use the author's language setting?

No, lang: uses the language X detects in the post itself.

Can you search by country instead of language?

Not reliably; location operators return few posts. Language plus local keywords works better.

What is the code for Chinese?

lang:zh covers Chinese posts.