A JavaScript library for generating vector-based cartoon faces

To load new random faces, click here or press "r" on your keyboard.

faces.js is a JavaScript library that generates and displays cartoon faces, somewhat reminiscent of how the Nintendo Wii generates random Miis. Faces are drawn as scalable vector graphics (SVG). Each face can also be represented by a small JavaScript object, which allows you to store that object and then draw the same face again later.

As you can probably tell, the number of options for each facial feature (eyes, nose, mouth, etc.) is fairly limited, and some of the current options are fairly crude. So fork it on GitHub and add some new options!


1. Install from npm:

$ npm install --save facesjs

Or yarn:

$ yarn add facesjs

2. Display a randomly-generated face (the size of the #my-div-id div determines the size of the displayed face):

import { display, generate } from "facesjs";

// Generate a random face
const face = generate();

// Display in a div with id "my-div-id"
display("my-div-id", face);


See all the available options in the faces.js editor.

For more documentation and information, see the README on GitHub.

Fork me on GitHub