Accurately remove and replace emojis in text strings
Low maintenance activity. Last release 7 months ago, commits in 0 of the last 26 weeks. Weaker on commit activity and release cadence.
pip install demojidemoji
Accurately find or remove emojis from a blob of text using data from the Unicode Consortium's emoji code repository.
Install
pip install demoji
# or, with uv:
uv add demoji
demoji supports Python 3.10 – 3.14 and bundles Unicode emoji data (version 16.0) at install time,
so no network access is required at runtime. See CHANGELOG.md for the full history.
To report a regression, please open a GitHub issue.
Basic Usage
demoji exports several text-related functions for find-and-replace functionality with emojis:
>>> tweet = """\
... #startspreadingthenews yankees win great start by 🎅🏾 going 5strong innings with 5k’s🔥 🐂
... solo homerun 🌋🌋 with 2 solo homeruns and👹 3run homerun… 🤡 🚣🏼 👨🏽⚖️ with rbi’s … 🔥🔥
... 🇲🇽 and 🇳🇮 to close the game🔥🔥!!!….
... WHAT A GAME!!..
... """
>>> demoji.findall(tweet)
{
"🔥": "fire",
"🌋": "volcano",
"👨🏽\u200d⚖️": "man judge: medium skin tone",
"🎅🏾": "Santa Claus: medium-dark skin tone",
"🇲🇽": "flag: Mexico",
"👹": "ogre",
"🤡": "clown face",
"🇳🇮": "flag: Nicaragua",
"🚣🏼": "person rowing boat: medium-light skin tone",
"🐂": "ox",
}
See below for function API.
Command-line Use
You can use demoji or python -m demoji to replace emojis
in file(s) or stdin with their :code: equivalents: