Summary

NSFW JS is an open-source JavaScript library from Infinite Red that detects and categorises potentially inappropriate images directly in the user's browser, built on TensorFlow.js.

Key Features

Client-side image classification using TensorFlow.js, so images never leave the browser
Classifies images into five classes: Drawing, Hentai, Neutral, Porn and Sexy
Returns prediction probabilities with confidence levels for each class
Works with <img>, <video> and <canvas> elements
Around 90% accuracy with the small model and around 93% with the midsized model
MobileNetV2-based model, with an option to host your own model
Simple API: load the model, then call classify on any image element
Free and open source under the MIT licence, installable via npm

About NSFW JS


Developers load the pre-trained model and call classify on any image, video or canvas element to get probability scores across five classes — Drawing, Hentai, Neutral, Porn and Sexy — with around 90% accuracy from the small model and around 93% from the midsized model, making it suitable for content moderation on sites with user-generated images.


Because all processing happens client-side, no images are sent to a server, which protects user privacy and reduces server load; it is free under the MIT licence, installable from npm, and ships with a live demo at nsfwjs.com.

Get more likes & reach the top of search results by adding this button on your site!

Embed button preview - Light theme
Embed button preview - Dark theme
TurboType Banner

Subscribe to the AI Search Newsletter

Get top updates in AI to your inbox every weekend. It's free!