Free OTP widget for your website: add mobile number verification without coding

The Fast2SMS free OTP widget is a ready-made phone verification box (an OTP verification widget for your website) that you add to any website with two lines of code. Your visitor types their mobile number, gets a 6-digit code by SMS or WhatsApp through Smart OTP, and the widget tells your page that the number is verified. You do not need a server, a backend or an API key on the website. The widget itself costs nothing. You pay only for each OTP it sends.

What your visitors see

The widget shows a Mobile number field with +91 in front and a Send OTP button. You can add a title such as “Verify your mobile number” and your logo. Here it is on the sign-up page of a sample website:

Sample sign-up page Create your account with the OTP widget: title Verify your mobile number, a Mobile number field with +91 and a Send OTP button, Secured by Fast2SMS below
The OTP widget on a sample sign-up page, before the visitor types a number.

After Send OTP, a short “I am human” check runs inside the widget. Then the visitor sees “Enter the 6-digit code sent to 90xxxxxx01” with a Change link, six code boxes, a Verify button and a Resend code timer. On phones, the keyboard can offer to fill in the code from the SMS.

OTP widget asking to enter the 6-digit code sent to 90xxxxxx01, with a Change link, six code boxes with 4 digits typed, a Verify button and Resend code in 24s
The code step: six boxes, Verify and a Resend timer.

When the code is right, the widget shows “Mobile number verified” with a Use a different number link. Your page gets a one-time token, so your form or your server can go ahead.

OTP widget showing a green tick with Mobile number verified and a Use a different number link
After a correct code the number is verified.

The widget fits small screens. This is the same page on a phone:

The OTP widget on a phone screen on the Demo Traders sign-up page: code sent to 90xxxxxx01, six code boxes, Verify button and Resend code in 24s
The same widget on a phone.

Is the OTP widget really free?

Yes. There is no widget fee, no setup fee and no monthly fee. Each OTP the widget sends is charged from your Fast2SMS wallet at your normal Smart OTP rate, the same as an OTP sent with the Smart OTP API. Codes you send from the Test tab are real OTPs, so they are charged too.

Sending in bulk? For high OTP volumes our team offers discounted rates. Talk to our team or see OTP pricing.

Spend limits in Settings (step 6) keep your wallet safe from bots.

Before you start

  • A Fast2SMS account with wallet balance.
  • An approved Smart OTP template (OTP ID): SMS with an approved DLT template, or WhatsApp with an approved authentication or utility template.
  • The address of your website, for example demotraders.in.
  • Visitors with Indian mobile numbers. The widget accepts 10-digit numbers that start with 6, 7, 8 or 9.

How to add the free OTP widget to your website

  1. Get an approved OTP ID

    The widget sends codes with one Smart OTP template, called an OTP ID. In Smart OTP, open OTP Template List and click Add OTP Template. For SMS, choose your approved DLT OTP template. For WhatsApp, choose an approved authentication or utility template. You can add the other channel as a fallback. For the full steps, see the Smart OTP setup guide.

  2. Open New Widget and give it a name

    In the Smart OTP sidebar, find the OTP WIDGET group and click New Widget. In Widget name, type a name you will recognise later, such as “Website signup”.

    Empty New widget page with Setup, Design and Settings tabs, fields Widget name, OTP ID and Websites, a Template variables switch and a Create widget button
    New Widget in the OTP WIDGET group of the Smart OTP sidebar.
  3. Choose the OTP ID

    Click Select OTP ID. The Select OTP Template pop-up shows each approved template as a phone preview, with the filters All, SMS and WhatsApp and a search box. Click the template you want. It becomes a card with its channel and sender, and the message preview shows on the right. To pick another one later, click Change OTP ID.

    Select OTP Template pop-up with All, SMS and WhatsApp filters and phone previews of WhatsApp and SMS OTP templates, each with its OTP ID on top
    Pick the OTP template the widget should send.
  4. Add your websites and template variables

    In Websites, type each address on its own line, for example demotraders.in and www.demotraders.in. Use *.example.com to allow all subdomains. The widget works only on these websites. On any other site it shows “Mobile verification is not available on this page right now.” To try it on your own computer first, you can add localhost.

    If your OTP template has other variables besides the code, such as a validity time, turn on Template variables and type fixed values for them, separated by | (the same format as the variables_values field of the API). Then click Create widget.

    Setup tab of the widget Website signup with SMS OTP ID b35f0e7a91 from sender DMTRDS, websites demotraders.in, www.demotraders.in and localhost, and the SMS message preview
    The Setup tab after the widget is created (test account).
  5. Match the design to your site

    On Design, set the Button colour (teal #12AA9E by default) and the Button text (default “Send OTP”). Turn on Title and logo to show a heading such as “Verify your mobile number” and your logo from a Logo URL. The preview on the right changes as you type. Click Save changes.

    Design tab with Button colour #12AA9E, Button text Send OTP, the Title and logo switch on with the title Verify your mobile number, and a live preview of the widget
    Colour, button text, title and logo, with a live preview.
  6. Set limits, the next page and a webhook

    On Settings, the Limits protect your wallet from bots. Each limit has a switch. A limit that is off uses the safe default:

    Limit Default when off Highest you can set
    Max spend per day ₹100 ₹5,000
    Max spend per month ₹1,000 ₹50,000
    Max codes per day 200 5,000
    Max codes per number per hour 3 10
    Max codes per visitor per hour 10 50

    When a daily or monthly cap is reached, the widget stops sending until midnight IST, and My Widgets shows “Stopped today”.

    Two more options sit on the same tab. After verify, open a page sends the visitor to a page you choose, such as a thank-you page. Send verified numbers to my webhook posts each verified number to your https URL. Developers can read how both work in OTP widget webhook and f2s_token check.

    Settings tab with all five limits switched on: max spend per day 50 rupees, per month 500 rupees, 100 codes per day, 3 codes per number per hour and 5 per visitor per hour
    Limits switched on with lower values than the defaults.
  7. Test it in the panel

    After saving, the widget page has six tabs: Setup, Design, Settings, Test, Install and Usage. Open Test, type your own number and click Send OTP. As the tab says, a real OTP is sent and charged. Type the code to check the whole flow. Reload starts again.

    Test tab with the note Try it with your own number. A real OTP is sent and charged, the widget with a number typed and a Reload link
    The Test tab runs the real widget inside the panel.
  8. Paste the code into your website HTML

    Open Install, stay on the Widget sub-tab and click Copy. Paste the two lines into your page where the box should appear:

    <script src="https://www.fast2sms.com/widget/otp-js?v=1.0.5" defer></script>
    <div data-f2s-otp-widget="YOUR_WIDGET_KEY"></div>

    Your widget key is already filled in when you copy from the panel. Always copy from there, because the version number in the first line can change.

    Install tab, Widget sub-tab with the text Paste this on your website where the widget should show, a Copy button and the script and div code
    Install, Widget: two lines to paste.
  9. Watch usage and switch it off when needed

    Usage shows today’s Sent, Verified, Wrong codes, Bots blocked and Spent today, plus the amount for This month. The Widget on switch at the top right turns the widget off on all your sites at once.

    Usage tab with tiles Sent, Verified, Wrong codes, Bots blocked, Spent today and This month, all at zero
    Usage for today and this month.

Four ways to show the widget

The Install tab has five sub-tabs. The first four are ways to put the widget on your page. The fifth, Server, is for developers who check the result on their own server.

Install sub-tab What you add Good for
Widget A div with data-f2s-otp-widget A verification box on a sign-up or login page
Popup data-f2s-otp-popup on your own button A “Verify mobile” or cash on delivery button
Mobile field data-f2s-otp-attach on your mobile input A form that already has a mobile number field
Form data-f2s-otp-protect on your form A form that must not submit until the number is verified

Full code for each mode, the 9 popup positions and the JavaScript events are in OTP popup on button click, mobile field and form protect. To check the result on your server, see verify f2s_token and the OTP widget webhook.

Hosted OTP widget or OTP widget kits

Fast2SMS also has the older OTP widget kits. They are open-source code that you run on your own server with your own API key, and they suit developers who want full control. If you prefer to host the code yourself, see the OTP widget kits.

Hosted OTP widget (this page) OTP widget kits
Your own server Not needed Needed (PHP, Node.js, Python and others)
API key Never on your website or server In your backend settings
Setup Panel settings plus 2 lines of code Download, configure and deploy
Limits and bot check Built in, set in Settings Handled by your backend

Mobile number verification for a website without coding

You only paste the code the panel gives you, so you do not have to write any. Most website builders have a place for your own HTML, such as an HTML block or a code embed. We have separate guides for WordPress without a plugin, Shopify and Wix, Webflow and Blogger. For a login that sends the code on WhatsApp, see the WhatsApp OTP widget. In Hindi: website par OTP verification kaise lagaye.

Some builders run custom code inside their own frame on a different domain. There the widget shows “not available”. Use the builder’s site-wide custom code or a code block that runs on your own domain instead, then check it with the Test tab and on the live page.

If your site sends a Content Security Policy header, allow Fast2SMS in it: script-src https://www.fast2sms.com; frame-src https://www.fast2sms.com. Most small sites do not have one.

How the widget keeps your account safe

  • Your API key never goes into the website. The widget runs in a frame from www.fast2sms.com.
  • Your page gets only a one-time token and the masked number, such as 98xxxxxx10. The code and the full number stay inside the widget. Your server can get the full number through the token check or the webhook.
  • A bot check runs on every send and resend, on top of the per-number, per-visitor, per-day and spend limits. Read more about OTP SMS pumping fraud.
  • The code has 6 digits and is valid for 10 minutes. Resend works after 30 seconds and your own Smart OTP resend setting.

Common problems and fixes

What you see What to do
“Mobile verification is not available on this page right now.” Add the exact address in Websites (with and without www), check that Widget on is on, and see the website builder note above.
Nothing shows on the page Check that both lines were pasted and that your builder did not remove the script line.
“Stopped today” in My Widgets A daily or monthly cap was reached. Raise the limit in Settings or wait until midnight IST.
The code does not arrive Check your wallet balance, the OTP template and the Smart OTP Delivery Report.

Frequently asked questions

Is the Fast2SMS OTP widget free?

Yes. Creating and using the widget is free, with no setup or monthly fee. You pay only for each OTP sent, at your Smart OTP rate, from your wallet.

Can I add OTP verification to my website without coding?

Yes. You set everything in the panel and paste two lines of code that the Install tab gives you. No server or backend is needed.

Can the widget send the OTP on WhatsApp?

Yes. Choose a WhatsApp OTP ID in Setup. See the WhatsApp OTP widget guide.

How do I show an OTP popup on my website?

Use the Popup install mode. Your own button opens the widget in a popup. Details are in the popup and mobile field guide.

How many widgets and websites can I add?

Up to 20 widgets per account, and up to 20 websites per widget.

How does my server know the number was really verified?

Check the one-time f2s_token with the verify-token API, or receive the number on your webhook. Both are explained in the f2s_token and webhook guide.