A recaptcha site key is a public identifier assigned by Google to verify that a website is authorized to use reCAPTCHA services. It pairs with a private secret key to authenticate requests between your site and Google's servers, enabling bot detection and human verification.
When a user interacts with a form or login page protected by reCAPTCHA, your site sends the site key to Google's servers. Google uses this key to validate the request, assess behavior patterns, and return a response indicating whether the user is likely a human. The site key helps only registered domains can trigger reCAPTCHA challenges.
Google requires both the site key and secret key for proper configuration. The site key is embedded in your frontend code (JavaScript), while the secret key remains server-side and never exposed publicly. Without the correct site key, reCAPTCHA fails to load or returns errors during verification.
When a visitor accesses a web form protected by reCAPTCHA, the browser loads the reCAPTCHA JavaScript library using your site key. This triggers a request to Google's API endpoint, which evaluates the user's interaction-mouse movements, click timing, device fingerprinting, and network context-to determine if the behavior resembles a human.
If the system detects suspicious activity, it presents a challenge such as "I'm not a robot" checkbox (v2) or a silent score-based check (v3). The result is sent back to your site via a callback function. Your backend then validates the response using the secret key and the site key's associated domain.
For example, if you're running a WordPress contact form with reCAPTCHA v3, your site's JavaScript includes:
<script src="https://www.google.com/recaptcha/api.js?render=YOUR_SITE_KEY"></script>
Then, when the form submits, JavaScript calls grecaptcha.execute() with that same site key. The server receives a token and verifies it against Google's API using the secret key.
Google offers two main versions of reCAPTCHA, each with distinct site key behaviors:
| Version | Site Key Purpose | Verification Method | Use Case Example |
|---|---|---|---|
| reCAPTCHA v2 | Triggers visible checkbox challenge | User clicks "I'm not a robot" | High-risk forms like account registration |
| reCAPTCHA v3 | Runs invisible checks in background | Score-based risk assessment (0.0-1.0) | Comment sections, login attempts, frequent form submissions |
Both versions require a unique site key per domain. You cannot reuse a site key across multiple domains-even if they belong to the same organization. Google enforces this to prevent abuse and ensure accountability.
Each site key is tied to a specific domain listed during setup. If you try to load reCAPTCHA on a subdomain not included in the registration, Google blocks the request. For example, if your site key is registered for "example.com," loading it on "blog.example.com" fails unless explicitly added during setup.
Many developers assume the site key alone can validate responses. That's incorrect. The site key is only part of the authentication chain. The server must use the secret key to verify the token returned by the client. Sending only the site key to your backend results in failed validation.
Another misconception is that reCAPTCHA v3 doesn't require a site key. This is false. Even though v3 runs silently, it still relies on the site key to identify the origin of the request. Without it, Google cannot associate the user's behavior with your site.
Also, site keys are not static. If you migrate a site to a new domain or rebuild it with a different URL structure, you must generate a new site key for the new domain. Reusing old keys leads to validation failures and increased spam.
Suppose you're building a newsletter signup form on a site hosted at https://news.example.com. You want to prevent bot signups.
news.example.com.6LeIxAcT3z-mAYKTXeQXd2VtORIEl7YdF3J5) and paste it into your form's JavaScript:<script src="https://www.google.com/recaptcha/api.js?render=6LeIxAcT3z-mAYKTXeQXd2VtORIEl7YdF3J5"></script>
<script>
grecaptcha.ready(function() {
grecaptcha.execute('6LeIxAcT3z-mAYKTXeQXd2VtORIEl7YdF3J5', { action: 'submit' }).then(function(token) {
// Send token to your server
document.getElementById('recaptcha-response').value = token;
});
});
</script>
On the server side, you send the token to Google's verification endpoint along with the secret key:
POST https://www.google.com/recaptcha/api/siteverify
Content-Type: application/x-www-form-urlencoded
secret=YOUR_SECRET_KEY&response=TOKEN_FROM_CLIENT
Google responds with a JSON object containing success: true if the user passed the test. Only then do you accept the form submission.
The site key acts as a trust anchor. Without it, anyone could spoof reCAPTCHA challenges. Google uses the site key to enforce domain binding and prevent cross-site abuse. A site key issued for "example.com" won't work on "malicious.site" even if the same secret key were leaked.
According to Google's documentation, site keys are designed to be public. They're safe to embed in HTML or JavaScript because they don't grant access to sensitive operations. The actual authorization happens through the secret key, which must remain confidential.
I once tested a misconfigured form where the site key was hardcoded in a public GitHub repository. While the site key itself didn't expose the secret key, attackers could use it to probe the form's behavior. After removing the key from version control and regenerating it, the form stopped being targeted by automated scripts.
Google recommends limiting site key usage to one domain per key. Multiple domains require separate keys. This prevents accidental exposure and simplifies troubleshooting.
Understanding the role of the recaptcha site key is essential for securing web forms. It's not just a technical detail-it's a core component of bot mitigation and user trust. Always treat the site key as a public credential and the secret key as a private one. Together, they form a layered defense against automated abuse.