#emoji #github #unicode #gemoji

no-std emojis

✨ Lookup emoji in *O(1)* time, access metadata and GitHub shortcodes, iterate over all emoji, and more!

15 releases

0.6.2 Apr 21, 2024
0.6.1 Sep 4, 2023
0.6.0 Apr 18, 2023
0.5.2 Nov 25, 2022
0.1.1 Mar 29, 2021

#28 in Text processing

Download history 5563/week @ 2024-01-27 3930/week @ 2024-02-03 3202/week @ 2024-02-10 3657/week @ 2024-02-17 3184/week @ 2024-02-24 3421/week @ 2024-03-02 4174/week @ 2024-03-09 4518/week @ 2024-03-16 5008/week @ 2024-03-23 4360/week @ 2024-03-30 3983/week @ 2024-04-06 5076/week @ 2024-04-13 6440/week @ 2024-04-20 6338/week @ 2024-04-27 8228/week @ 2024-05-04 5805/week @ 2024-05-11

27,412 downloads per month
Used in 34 crates (25 directly)


12K SLoC


Crates.io Version Docs.rs Latest Build Status

✨ Lookup emoji in O(1) time, access metadata and GitHub shortcodes, iterate over all emoji.


  • Lookup up emoji by Unicode value
  • Lookup up emoji by GitHub shortcode (gemoji v4.1.0)
  • Access emoji metadata: name, unicode version, group, skin tone, gemoji shortcodes
  • Iterate over emojis in Unicode CLDR order
  • Iterate over emojis in an emoji group, e.g. “Smileys & Emotion” or “Flags”
  • Iterate over the skin tones for an emoji
  • Select a specific skin tone for an emoji
  • Uses Unicode v15.1 emoji specification

Getting started

First, add the emojis crate to your Cargo manifest.

cargo add emojis

Simply use the get() function to lookup emojis by Unicode value.

let rocket = emojis::get("🚀").unwrap();

Or the get_by_shortcode() function to lookup emojis by gemoji shortcode.

let rocket = emojis::get_by_shortcode("rocket").unwrap();

These operations take Ο(1) time.


Currently the minimum supported Rust version is 1.60 due to the dependency on phf. The policy of this crate is to only increase the MSRV in a breaking release.

Breaking changes

When gemoji or the Unicode version is upgraded this is not considered a breaking change, instead you should make sure to use unicode_version() to filter out newer versions.


See examples/replace.rs for an example that replaces :gemoji: names with real emojis in text.

$ echo "launch :rocket:" | cargo run --example replace
launch 🚀

get() and get_by_shortcode() return an Emoji struct which contains various metadata regarding the emoji.

let hand = emojis::get("🤌").unwrap();
assert_eq!(hand.as_str(), "\u{1f90c}");
assert_eq!(hand.as_bytes(), &[0xf0, 0x9f, 0xa4, 0x8c]);
assert_eq!(hand.name(), "pinched fingers");
assert_eq!(hand.unicode_version(), emojis::UnicodeVersion::new(13, 0));
assert_eq!(hand.group(), emojis::Group::PeopleAndBody);
assert_eq!(hand.skin_tone(), Some(emojis::SkinTone::Default));
assert_eq!(hand.shortcode(), Some("pinched_fingers"));

Use skin_tones() to iterate over the skin tones of an emoji.

let raised_hands = emojis::get("🙌🏼").unwrap();
let skin_tones: Vec<_> = raised_hands.skin_tones().unwrap().map(|e| e.as_str()).collect();
assert_eq!(skin_tones, ["🙌", "🙌🏻", "🙌🏼", "🙌🏽", "🙌🏾", "🙌🏿"]);

You can use the iter() function to iterate over all emojis. This only includes the default skin tone versions.

let faces: Vec<_> = emojis::iter().map(|e| e.as_str()).take(5).collect();
assert_eq!(faces, ["😀", "😃", "😄", "😁", "😆"]);

It is recommended to filter the list by the maximum Unicode version that you wish to support.

let iter = emojis::iter().filter(|e| {
    e.unicode_version() < emojis::UnicodeVersion::new(13, 0)

Using the Group enum you can iterate over all emojis in a group.

let fruit: Vec<_> = emojis::Group::FoodAndDrink.emojis().map(|e| e.as_str()).take(5).collect();
assert_eq!(fruit, ["🍇", "🍈", "🍉", "🍊", "🍋"]);


This project is distributed under the terms of both the MIT license and the Apache License (Version 2.0).