How to Set Up Google reCAPTCHA in Magento 2
Google reCAPTCHA is a powerful tool that protects your Magento 2 store from bots, spam, and fraudulent activity. By adding reCAPTCHA to forms like login and registration, you can improve security without disrupting the user experience. In this guide, we’ll show you How to Set Up Google reCAPTCHA in Magento 2, including how to generate your Site Key and Secret Key from Google.
Steps To Set Up Google reCAPTCHA in Magento 2
1. Generate Google reCAPTCHA Site Key and Secret Key
To begin, you’ll need a Site Key and Secret Key from Google reCAPTCHA:
- Go to Google reCAPTCHA Admin Console.
- Log in with your Google account.
- Fill in the form:
- Label: Enter a name (e.g., “Magento2 Store”).
- reCAPTCHA type: Choose reCAPTCHA v2 or v3 (Magento 2 supports both).
- Domains: Add your domain (e.g.,
yourdomain.com
). - Accept the reCAPTCHA Terms of Service.
- Click Submit.
- Copy the Site Key and Secret Key—you’ll need them in our blog (How To Get Site Key And Secret Key From Google reCAPTCHA).
2. Enable Google reCAPTCHA in Magento 2
After obtaining your Site Key and Secret Key from Google, the next step is to enable and configure reCAPTCHA in your Magento 2 Admin Panel. Follow these steps:
Step 1: Log In to Magento Admin
Step 2: Navigate to reCAPTCHA Settings
From the left sidebar, go to: Stores > Settings > Configuration
In the Configuration menu, on the left panel, scroll down to: Security > Google reCAPTCHA Admin Panel /Storefront

Step 3: Configure reCAPTCHA
Configuring the Google reCAPTCHA method you want to use:
- reCAPTCHA v2 (“I am not a robot”)

- reCAPTCHA v2 Invisible

- reCAPTCHA v3 Invisible

- reCAPTCHA Failure Messages

Paste your Site Key and Secret Key from Google and select optional settings
In Google reCAPTCHA Admin Panel, expand Admin Panel section and select method for Login form and Forgot Password form.

In Google reCAPTCHA Storefront, expand Storefront section, you will see multiple sections like:
- Enable for Customer Login
- Enable for Forgot Password
- Enable for Create New Customer Account
- Enable for Edit Customer Account
- Enable for Contact Us
- …

You can enable reCAPTCHA for any form you want and select any method accordingly.
Step 6: Save and Flush Cache
3. Test the Integration
Visit your store’s login or contact form to verify reCAPTCHA is displaying properly. If it’s not showing:
- Ensure the keys are correct.
- Check that your domain matches what you registered with Google.
- Clear browser and Magento cache.
Integrating Google reCAPTCHA in Magento 2 is a quick and effective way to enhance store security without hurting usability. With just a few steps, you can prevent malicious bots and reduce spam—helping you protect both your site and your customers. Need help with setup or choosing v2 vs v3? Feel free to reach out!
Follow us for the more helpful posts!
We hope this is a useful post for you.
Thank you for reading!