Emotion API

Analyse faces to detect a range of feelings and personalise your app’s responses.

Recognise emotions in images

The Emotion API takes a facial expression in an image as an input, and returns the confidence across a set of emotions for each face in the image, as well as bounding box for the face, using the Face API. If a user has already called the Face API, they can submit the face rectangle as an optional input.

The emotions detected are anger, contempt, disgust, fear, happiness, neutral, sadness and surprise. These emotions are understood to be communicated universally across cultures with particular facial expressions.

See it in action

Anger 0.00000
Contempt 0.00000
Disgust 0.00000
Fear 0.00000
Happiness 1.00000
Neutral 0.00000
Sadness 0.00000
Surprise 0.00000
Anger 0.00245
Contempt 0.00055
Disgust 0.00633
Fear 0.00012
Happiness 0.95892
Neutral 0.02225
Sadness 0.00898
Surprise 0.00039
Anger 0.00001
Contempt 0.00000
Disgust 0.00000
Fear 0.00000
Happiness 0.99999
Neutral 0.00000
Sadness 0.00000
Surprise 0.00000
Anger 0.00000
Contempt 0.00000
Disgust 0.00000
Fear 0.00000
Happiness 0.99999
Neutral 0.00000
Sadness 0.00000
Surprise 0.00000
Detection result:
4 faces detected

[ { "FaceRectangle": { "Top": 114, "Left": 212, "Width": 65, "Height": 65 }, "Scores": { "Anger": 1.0570484E-08, "Contempt": 1.52679547E-09, "Disgust": 1.60232943E-07, "Fear": 6.00660363E-12, "Happiness": 0.9999998, "Neutral": 9.449728E-09, "Sadness": 1.23025981E-08, "Surprise": 9.91396E-10 } }, { "FaceRectangle": { "Top": 141, "Left": 331, "Width": 52, "Height": 52 }, "Scores": { "Anger": 0.002451766, "Contempt": 0.0005512201, "Disgust": 0.0063303886, "Fear": 0.000122375583, "Happiness": 0.9589189, "Neutral": 0.0222537462, "Sadness": 0.008983561, "Surprise": 0.000388026354 } }, { "FaceRectangle": { "Top": 110, "Left": 70, "Width": 51, "Height": 51 }, "Scores": { "Anger": 5.382089E-06, "Contempt": 3.84402554E-08, "Disgust": 8.22284051E-07, "Fear": 1.46369352E-08, "Happiness": 0.999993265, "Neutral": 9.765083E-08, "Sadness": 9.01927848E-08, "Surprise": 2.7211172E-07 } }, { "FaceRectangle": { "Top": 116, "Left": 459, "Width": 45, "Height": 45 }, "Scores": { "Anger": 3.95796542E-06, "Contempt": 2.44360656E-08, "Disgust": 3.291685E-07, "Fear": 1.935065E-09, "Happiness": 0.9999912, "Neutral": 2.461666E-06, "Sadness": 1.96641076E-06, "Surprise": 8.561949E-08 } } ]

By uploading data for this demo, you agree that Microsoft may store it and use it to improve Microsoft services, such as making this API better. To help protect your privacy, we take steps to de-identify your data and keep it secure. We won’t publish your data or let other people use it.

Want to build this?

Recognise emotions in video

The Emotion API for Video recognises the facial expressions of people in a video, and returns a summary of their emotions. You can use this API to track how a person or a crowd responds to your content over time. The emotions detected are anger, contempt, disgust, fear, happiness, neutral, sadness and surprise.

Recognise emotions in near real time by extracting frames of a video and then sending those frames to the API calls of your choice. Get results faster and quickly start coding using our sample on GitHub.

Learn more

See it in action

Want to build this?

Have a look at the other Cognitive Services APIs

Computer Vision API

Distil actionable information from images

Content moderator

Automated image, text and video moderation


Intelligent video processing

Video Indexer PREVIEW

Unlock video insights

Face API

Detect, analyse, organise and tag faces in photos


Personalise user experiences with emotion recognition

Custom Vision Service PREVIEW

Easily customise your own state-of-the-art computer vision models for your unique use case.

Language Understanding Intelligent Service PREVIEW

Teach your apps to understand commands from your users

Bing Spell Check API

Detecting and correcting spelling mistakes in your app

Web Language Model API PREVIEW

Use the power of predictive language models trained on web-scale data

Text Analytics API PREVIEW

Easily evaluate sentiment and topics to understand what users want

Translator Text API

Easily conduct machine translation with a simple REST API call

Linguistic Analysis API PREVIEW

Simplify complex language concepts and parse text with the Linguistic Analysis API.

Translator Speech API

Easily conduct real-time speech translation with a simple REST API call

Bing Speech API

Convert speech to text and back again to understand user intent

Speaker Recognition API PREVIEW

Use speech to identify and authenticate individual speakers

Custom Speech Service PREVIEW

Overcome speech recognition barriers like speaking style, background noise and vocabulary

Recommendations API PREVIEW

Predict and recommend items that your customers want

Knowledge Exploration Service PREVIEW

Enable interactive search experiences over structured data via natural language inputs

Entity Linking Intelligence Service API PREVIEW

Power your app’s data links with named entity recognition and disambiguation.

Academic Knowledge API PREVIEW

Tap into the wealth of academic content in the Microsoft Academic Graph


Distil information into conversational, easy-to-navigate answers.

Custom Decision Service PREVIEW

A cloud-based, contextual decision-making API that sharpens with experience

Project Prague

Gesture-based controls

Project Nanjing

Isochrones calculations

Project Johannesburg

Route logistics

Project Cuzco

Event associated with Wikipedia entries

Project Abu Dhabi

Distance matrix

Project Wollongong

Location insights

Ready to supercharge your app?