NSFW JS Overview
NSFW JS is a powerful and accessible open-source JavaScript library designed to help developers identify and filter Not Safe For Work (NSFW) content on the client side. By leveraging the capabilities of TensorFlow.js, NSFW JS runs a sophisticated image classification model directly within the user's web browser. This means that images do not need to be uploaded to a server for analysis, offering a significant advantage in terms of user privacy, speed, and cost-effectiveness. The library is capable of classifying images into five distinct categories: Drawing, Hentai, Neutral, Porn, and Sexy, providing nuanced results beyond a simple safe/unsafe binary.
The core of NSFW JS is a lightweight yet accurate model (approximately 4.2MB), which achieves around 93% accuracy. This balance makes it perfectly suited for real-time applications where performance is critical, such as moderating user-uploaded content, filtering live video streams, or providing protective overlays on potentially sensitive material. As an open-source project, it is completely free to use and benefits from community contributions and support.
How to use NSFW JS
Integrating NSFW JS into a web project is straightforward for developers familiar with JavaScript. The process generally involves these steps:
- Installation: Add the library to your project. This can be done using a package manager like npm (
npm install nsfwjs) or by including the script directly in your HTML file from a CDN. - Model Loading: In your JavaScript code, you first need to load the pre-trained NSFW JS model. This is an asynchronous operation, so it's best handled with async/await or Promises. The model is typically hosted on a CDN for easy access.
- Image Classification: Once the model is loaded, you can call the
classifymethod. This method accepts an image source, which can be an HTML<img>element, a<video>element, or a<canvas>element. - Processing Results: The
classifymethod returns an array of predictions. Each prediction is an object containing aclassName(e.g., 'Porn', 'Sexy', 'Neutral') and aprobabilityscore (from 0 to 1). - Implementing Logic: Based on the returned probabilities, you can implement your desired action. For example, if the probability for 'Porn' or 'Hentai' is above a certain threshold, you could automatically hide the image, apply a blur filter, or display a content warning to the user.
Core Features of NSFW JS
- Client-Side Processing: All analysis happens in the user's browser, ensuring that sensitive images are never transmitted to a server, thus protecting user privacy.
- Multi-Label Classification: Provides granular results by classifying images into five categories: Porn, Hentai, Sexy, Drawing, and Neutral.
- High Accuracy: The model boasts approximately 93% accuracy in identifying inappropriate content.
- Lightweight and Fast: The small model size ensures quick loading times and real-time performance, suitable for interactive web applications.
- Open Source: Completely free to use, modify, and distribute under the MIT license. The project is actively maintained on GitHub.
- Powered by TensorFlow.js: Built on Google's popular and robust machine learning library for JavaScript, ensuring reliability and future compatibility.
Use Cases for NSFW JS
NSFW JS is a versatile tool for any application dealing with user-generated visual content. Key use cases include:
- Automated Content Moderation: Automatically flag, blur, or block user-uploaded images and avatars on social media platforms, forums, and chat applications.
- Brand Safety: For ad networks and publishers, ensuring that advertisements are not displayed alongside inappropriate content.
- Parental Control Tools: Building browser extensions or applications that filter web content in real-time to create a safer online environment for children.
- Real-time Video Filtering: Moderating live video streams or webcam feeds by analyzing frames on the fly to detect and obscure NSFW content.
- Compliance and AUP Enforcement: Helping online services enforce their Acceptable Use Policies by programmatically identifying content that violates terms of service.
Advantages of NSFW JS
The primary advantages of using NSFW JS stem from its client-side architecture and open-source nature:
- Enhanced Privacy: The most significant benefit is that user data remains on their device, which is crucial for privacy-conscious applications.
- Zero Server-Side Costs: Since the computation is offloaded to the client, there are no server costs associated with image analysis, making it highly scalable and economical.
- Low Latency: Real-time analysis without network round-trips provides an instant response, improving the user experience.
- Easy Integration: As a JavaScript library, it can be seamlessly integrated into any modern web stack.
- Community Driven: Being open-source means it is constantly being reviewed and improved by a community of developers.
Pricing and Plans
NSFW JS is a completely free, open-source software project distributed under the MIT License. There are no pricing plans, subscriptions, or hidden fees. Developers can freely use it in both personal and commercial projects. The source code and documentation are available on its official GitHub repository.
Traffic
Latest traffic
Status
Monthly traffic trend
- 2025-9: 9.5K
- 2026-1: 12.2K
- 2026-2: 13.7K
- 2026-3: 39.7K
- 2026-4: 41.3K
- 2026-5: 53.1K
Geography
Top 5 countries / regions
- 🇺🇸United States46.0%
- 🇮🇩Indonesia15.5%
- 🇮🇳India15.5%
- 🇰🇷South Korea13.1%
- 🇩🇪Germany9.9%
Traffic sources
| Source type | Percentage |
|---|---|
Referral | 73.3% |
Direct | 26.7% |
Top keywords
| Keyword | Cost per click |
|---|---|
| nsfw | $3.62 |
| nsfw js | $0.00 |
| nsfwjs | $0.00 |
| nsfwjs npm | $0.00 |
| sfwjs | $0.00 |
NSFW JS Alternatives

Deepengin
Deepengin is an all-in-one REST API for developers, providing comprehensive AI-powered image and video moderation. It automatically detects nudity, weapons, hate symbols, and other inappropriate content to ensure platform safety and compliance. It also includes features like OCR, celebrity recognition, and image compression.
Api
Checkstep
Checkstep is an AI-driven Trust and Safety platform providing comprehensive content moderation services. It scans images, videos, audio, and text in over 100 languages to detect various forms of abuse, including hate speech, misinformation, and deepfakes. The platform helps teams enforce policies, automate compliance with regulations like the DSA, and significantly reduce human moderation costs while protecting moderators' well-being.
Api
SeyftAI
SeyftAI is a real-time, multi-modal AI content moderation platform. It filters harmful and irrelevant content across text, images, and videos, ensuring safe online spaces, compliance, and offering personalized solutions for diverse languages and cultural contexts.
Api
papert
papert is an open-source AI pair programmer that integrates with your local Git repository. It allows developers to collaborate with LLMs like GPT-4o and Claude 3.5 Sonnet to ask questions, edit code across multiple files, refactor, debug, and automate routine coding tasks.
Debugging
Home Assistant
Home Assistant is a powerful, open-source home automation platform that prioritizes local control and user privacy. It integrates with thousands of smart devices and services, allowing you to create powerful automations, custom dashboards, and even use a private, local voice assistant. Powered by a global community, it puts you in complete control of your smart home data.
Open SourceNSFW JS Categories
NSFW JS Embed Widget
Copy this embed code to place the badge on your blog, article, or product site and send readers directly to this ToolMage detail page.















NSFW JS Comments (0)
Sign in to comment.
Sign inNo comments yet.