Developers

How to copy emoji for HTML, CSS and JavaScript

An emoji is a character, but code often needs a specific representation. Use the format that matches the place where the value will be stored.

6 min read · English

The character itself

The plain character is the right choice for visible text, database values and content fields. Copy it from the emoji heading or the Character row in the Copy and paste section.

HTML entities

An HTML entity such as 😀 represents one code point. For sequences, include every code point in order. Entities are useful when an editor or template cannot store the raw character.

CSS escapes

CSS uses a backslash escape such as \1F600 followed by a space. The trailing space ends the escape. Keep all code points for multi-part emoji and preserve any zero-width joiners.

JavaScript escapes

In JavaScript strings, use \u{1F600}. The braces are required above U+FFFF. For a sequence, repeat the escape for each code point, including joiners and variation selectors.

Shortcodes are not universal

Shortcodes such as :grinning: belong to a platform or library. They are convenient in chat and some content systems, but they are not part of Unicode and may render differently elsewhere.

← All guides