v2.0.0 Now Available

Secure your forms without the hassle.

A lightweight, customizable, and dependency-free JavaScript CAPTCHA solution to protect your web applications from automated bots. It generates random CAPTCHA images that users must solve to verify their human identity.

Highly Customizable

Configure length, character types (digits, uppercase, special chars), and dimensions.

Lightweight

Zero dependencies. Tiny footprint. Doesn't bloat your bundle size.

  • Refresh button to generate a new CAPTCHA
  • Simple validation method
  • Prevents bots from automated form submissions
  • Adjustable CAPTCHA image size

Installation

1. Clone the repository:

Terminal
git clone https://github.com/codesuab/verifyjs.git

2. Include the script in your HTML:

<script src="core/verify.min.js"></script>

HTML Structure

Add the following markup to your form:

index.html
<div id="captchaForm">
  <div class="captchawraper">
    <img id="captcha" width="200" height="50" alt="CAPTCHA" />
  </div>
  <div class="fild">
    <input type="text" id="captchaInput" required />
    <button type="button" onclick="captchaRefresh()">Refresh</button>
  </div>
  <button onclick="validate()">Submit</button>
</div>

JavaScript Configuration

script.js
verifyJS({
  totalDigit: 4,        // Number of characters
  number: true,       // Include numbers
  uppercase: false,   // Include uppercase letters
  specialsCharacter: false, // Include special chars
  width: 140,         // Canvas width
  height: 50,         // Canvas height
}).vJSConfig();

// Set image on page load
window.onload = () => {
  verifyJS().vJSImgSrc("#captcha");
};

Customization Options

Modify these settings to customize your CAPTCHA:

Option Description Default
totalDigit Number of characters in the CAPTCHA 6
number Include numbers in CAPTCHA true
uppercase Include uppercase letters true
specialsCharacter Include special characters true
width Width of CAPTCHA image 200
height Height of CAPTCHA image 50

Contributing

If you'd like to improve VerifyJS, feel free to fork the repository and submit a pull request.

License

This project is licensed under the MIT License.

Show Support ❤️

Live Demo

Interactive
CAPTCHA

Click image to refresh code