
Twemoji
Twitter's open-source emoji images and a small JavaScript library to swap emoji characters for images.
- Stars
- 17.8k
- Forks
- 1.9k
- Licence
- MIT
- Language
- HTML
- Last update
- 4 months ago
- Type
- Library
What it is
Twemoji is a JavaScript library and image set from Twitter that replaces standard Unicode emoji characters with consistent picture files. This lets emoji look the same on every platform and browser instead of depending on each system's own emoji font. The graphics are licensed CC-BY 4.0, and the README asks users to give attribution.
- Add a script tag to a web page so emoji in text render as Twemoji images
- Call twemoji.parse on a DOM element to replace emoji inside its text nodes
- Convert between emoji characters and Unicode code points with the convert helpers
- Set a custom folder such as svg to load scalable emoji images
Great for
- Web developers who want the same emoji look across all browsers and operating systems
- Sites that display user-generated text and need emoji to render consistently
- Developers who want to resize emoji to match surrounding text using CSS
- Designers looking for a free, consistent emoji image set with attribution
Not ideal for
- Projects that need custom or non-Unicode emoji, since the README says custom emoji are not supported
- Anyone who wants to pass untrusted HTML strings directly to the string parser, because the README says that method does not sanitize input
- Projects that depend on the MaxCDN image host, which the README says is shut down
How to get it
- 1
Install with a package manager
Load the latest library from unpkg
<script src="https://unpkg.com/twemoji@latest/dist/twemoji.min.js" crossorigin="anonymous"></script> - 2
Run it
- Add the script tag to the head of your HTML page
- Add the meta charset utf-8 tag so emoji display correctly
- Call twemoji.parse(document.body) in your JavaScript
- Style img.emoji in CSS to size images to your text
- 3
Get the most out of it
- Use DOM parsing with an HTMLElement for the safest option, as the README recommends
- Set the size, ext, and folder options to choose PNG sizes or SVG files
- Use the callback option to exclude certain characters from being replaced
- Pin an exact version with its integrity hash if you need stable output
Downloads
Strengths
- Based on Unicode 14.0 and Emoji 14.0 specs, per the README
- Offers a DOM parsing mode that avoids innerHTML, which the README calls the safer option
- Permissive MIT license for the code, with CC-BY 4.0 graphics
Trade-offs
- The README says the MaxCDN default image host is shut down, so you must use another CDN or download the assets yourself
- The README notes that the string parsing method does not sanitize input, so it is not recommended
- Version 14 is the latest documented version, and the README points to a legacy API for older code
How it compares
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| twemoji (this) | 17.8k | Library | beginner | 4 months ago | Web developers who want the same emoji look across all browsers and operating systems |
| fluentui-emoji | 10.2k | Design asset | beginner | 2 months ago | Designers looking for a free emoji style to use in mockups or interfaces |
Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.