NSFWJS

100% client-side NSFW detection, free and under MIT license

💰Free (open source, MIT license) ★★★★½ 4.5/5 (53 reviews)
Code & Development Images
#API #Image generation #Integrations & APIs #Open source

Overview of NSFWJS

https://nsfwjs.com/
Screenshot of NSFWJS
Visit NSFWJS →

Présentation détaillée

Image moderation is a challenge for any website or application that accepts user-uploaded content. Between paid services that transmit your files to remote servers and expensive in-house solutions to develop, there is a middle ground: NSFWJS. This open-source JavaScript library, maintained by the Infinite Red studio, allows you to classify potentially explicit images directly in the browser or in Node.js, without ever sending the files to an external service. In practice, it relies on TensorFlow.js to run a computer vision model client-side and assign each image a score across five categories. For a web developer, this means a quick first filter to set up, free and privacy-friendly, ideal for identifying risky content before it appears on a platform. In the following sections, we detail exactly what NSFWJS is, how it works, its concrete use cases, its advantages, its business model, and what you need to take away from it.

What is NSFWJS?

NSFWJS is a JavaScript library designed to quickly identify potentially inappropriate images, as its own description states: helping to spot these images entirely in the client’s browser. The project is backed by Infinite Red and distributed under the MIT license, making it free, open, and modifiable. Technically, it relies on TensorFlow.js and offers several pre-trained models, notably MobileNetV2 and InceptionV3. From a provided image, the model calculates a probability for five distinct classes: Drawing (safe drawings, including animation), Hentai, Neutral (neutral content), Porn, and Sexy. The library works just as well in the browser as it does server-side with Node.js, and a companion package exists for React Native applications.

Key Features

The core of NSFWJS lies in a simple API. After loading the model with the load method, you call classify, passing it an image source: HTML image tag, canvas element, video, raw image data, or a TensorFlow.js tensor. The function returns the list of the five classes along with their probability, leaving the developer to choose the blocking threshold. Three models are offered depending on the trade-off sought between size and accuracy: a small MobileNetV2 model in 224×224, an intermediate variant, and a heavier InceptionV3 model in 299×299. The announced accuracy is around 90% for the small model and 93% for the intermediate model. The library supports several compute backends (WebGL, WebGPU, WASM, CPU) and can cache models in the browser via IndexedDB to speed up subsequent loads. An open-source Chrome extension project, NSFW Filter, actually relies on NSFWJS to hide sensitive images during browsing, illustrating the library’s flexibility.

Use Cases

NSFWJS naturally finds its place in content moderation on platforms that accept image uploads: forums, social networks, marketplaces, or comment sections. Since the analysis takes place client-side, you can block or blur a suspicious image even before it is sent to the server, which reduces bandwidth and protects user privacy. Browser extension developers use it to automatically filter displayed images, much like the NSFW Filter extension. The nsfwjs-mobile package paves the way for React Native applications that want to integrate content control on mobile. Finally, in a Node.js environment, NSFWJS can serve as a first sorting layer in an image processing pipeline, for example to flag content for manual review.

Advantages

The main advantage of NSFWJS is its entirely client-side operation: no images are transmitted to a third-party service, a strong argument for privacy and compliance. Next comes the total free-of-charge nature under the MIT license, which allows commercial use without fees or quotas. The library is lightweight to integrate, relies on the already well-documented TensorFlow.js ecosystem, and leaves the developer free to choose their model and thresholds. Its multi-environment compatibility (browser, Node.js, React Native) and its active open-source community make it a reusable building block in various contexts, from prototype to production product.

Pricing

NSFWJS is an open-source project published under the MIT license: it is free and has no paid tiers, subscriptions, or API keys to purchase. There is no official commercial hosted API or managed service: you install the library via npm or yarn and host the models yourself if you wish. The only potential costs are indirect, related to your own infrastructure if you run it in Node.js at scale. This lack of fees makes it a particularly attractive solution for budget-limited projects or experiments.

Conclusion

NSFWJS is a pragmatic response to the need for filtering sensitive images without relying on an external service. Free, open-source, and executed client-side, it offers developers a quick-to-deploy first safeguard that respects privacy. However, its 90% to 93% accuracy and the absence of a no-code interface destine it for technical teams, and it benefits from being supplemented by human review for high-stakes use cases. For a web or mobile developer looking for a free and reliable image moderation solution, it is an option worth knowing.

✅ Strengths

  • Client-side processing: images never leave the browser
  • Free MIT license, fully open-source code
  • Accepts image, canvas, video, or tensor as input
  • Three models to choose from, including MobileNetV2 and InceptionV3
  • Separate packages for React Native (nsfwjs-mobile) and Node.js

⚠️ Limits

  • Limited accuracy (~90-93%) insufficient for critical moderation on its own
  • No no-code interface: requires coding in JavaScript
  • The model adds download weight to the initial load
  • No hosted API or official commercial support
👤 GOOD CHOICE?

NSFWJS est-il fait pour vous ?

✓ Ideal if you…

  • Web developers integrating image filtering
  • Light content moderation projects
  • React Native and browser apps
  • Teams mindful of image privacy

✗ To avoid if you…

  • Non-developers seeking a turnkey solution
  • Critical legal moderation without human review
  • Users wanting a hosted SaaS API
  • Analysis of text or long video

🎯 Our verdict

NSFWJS meets a specific need: detecting potentially explicit images without relying on a third-party server. Since all computation runs via TensorFlow.js in the browser or in Node.js, the analyzed files are never transmitted, making it a solid choice for projects mindful of data privacy. The classify method returns probabilities for five classes (Drawing, Hentai, Neutral, Porn, Sexy) and accepts an image tag, a canvas, or a tensor, with a choice between MobileNetV2 and InceptionV3. Total free-of-charge availability under the MIT license and the presence of a dedicated React Native package further expand its scope of use. On the downside, the announced accuracy of 90% to 93% and the absence of a no-code interface reserve it for technical teams, and it should not be the sole safeguard for legally sensitive moderation. For a developer who wants a fast, privacy-respecting first filter, NSFWJS remains a reliable and cost-effective option.

❓ FREQUENT QUESTIONS

FAQ — NSFWJS

Is NSFWJS free?
Yes. NSFWJS is completely free and published under the MIT license, which allows commercial use and code modification.
Are images sent to a server?
No. All classification is performed client-side via TensorFlow.js, in the browser or in Node.js. Images do not leave the device.
What categories does NSFWJS detect?
It distributes each image into five classes with a probability score: Drawing, Hentai, Neutral, Porn, and Sexy.
What input formats are accepted?
The classify method accepts an image tag, a canvas element, a video, image data, or a TensorFlow.js tensor.
Can it be used in a mobile application?
Yes, via the dedicated nsfwjs-mobile package for React Native, in addition to browser and Node.js support.
★★★★½ 4.5/5 (53 avis)
✅ Verified by Comparateur-IA
Code & Development Images

100% client-side NSFW detection, free and under MIT license

💰 Rate Free (open source, MIT license)
🆓 Free trial Yes
🌐 Languages ANGLAIS, FRANçAIS
Visit the site →
This site is registered on wpml.org as a development site. Switch to a production site key to remove this banner.