How to bypass reCAPTCHA v2 captcha

To bypass a reCAPTCHA v2 captcha, read the site key in the page, send it with the page URL to a captcha solver API, then place the returned token in the form before it expires. This guide follows that token from the “I’m not a robot” checkbox, or the invisible badge, to Google’s siteverify check, and describes the image grids along the way.

Updated on · Written and maintained by the ilovecaptcha team

Preview: the API described here is in public beta. Endpoint names, fields and codes can still change until the end of the beta, and no API key is distributed yet.

What is reCAPTCHA v2, and how do the checkbox and the invisible badge differ?

reCAPTCHA v2 is the Google challenge introduced in 2014: a checkbox labelled “I’m not a robot”, backed by an image grid when Google wants more proof. According to Google, ticking the box “will either pass the user immediately (with No CAPTCHA) or challenge them to validate whether or not they are human”. The invisible variant removes the box: the check starts on a button click or a call to grecaptcha.execute, and by default only the most suspicious traffic has to solve a captcha.

How is each reCAPTCHA v2 mode declared in a page?

reCAPTCHA v2 modes: markup, trigger and what the visitor sees
Mode Markup in the page What starts the check What the visitor sees
Checkbox An element with the class g-recaptcha and a data-sitekey attribute The visitor ticks the box The box, then an immediate pass or an image grid
Invisible, bound to a button A button with the class g-recaptcha, data-sitekey and data-callback A click on that button A badge, bottom right by default, and a grid only if challenged
Invisible, called by script A div with data-size set to invisible A call to grecaptcha.execute The same badge, positioned with data-badge

Which image grids does reCAPTCHA v2 serve when the checkbox is not enough?

Grids of photographs, each with an instruction naming one object: buses, bicycles, motorcycles, traffic lights, crosswalks, stairs, fire hydrants. Google’s documentation does not describe them; the list below comes from what the widget displays. With the recaptcha-v2 task type you never send these pictures: the solver handles the grid and only the token comes back.

How a grid feels and how long it takes are two different things: in a USENIX Security 2023 study, 1,400 participants solved 14,000 CAPTCHAs, and solving time did not always track reported annoyance.

What do the 3×3 and 4×4 grids ask for?

  • 3×3 grid: nine separate pictures, each judged on its own. The visitor selects every picture that shows the object.
  • 3×3 grid with replaced tiles: the widget swaps the chosen pictures for new ones, and the same question continues.
  • 4×4 grid: a single photograph cut into 16 squares. The visitor selects every square that contains part of the object.

Why does one solved grid not always end the challenge?

Because reCAPTCHA v2 chains rounds. A first grid can be followed by another, and the object asked for can change on the way: a challenge that opens on motorcycles may continue with traffic lights, stairs or crosswalks. The token only exists once Google is satisfied with the whole sequence. An accepted selection is not yet a token, so a solver is judged on the token it returns, not on one grid of 9 or 16 tiles.

What happens to a reCAPTCHA v2 token between the widget and the site’s server?

It is issued once, checked once, then discarded. When the challenge is passed, the widget hands the page a response token. The site’s server posts it to Google’s siteverify endpoint with its secret key, and trusts the form only if the answer reports success. According to Google, each response token “is valid for two minutes, and can only be verified once to prevent replay attacks”. Past 120 seconds, or after a first verification, the string is worth nothing.

What does siteverify tell the site about a token?

  • success: true or false, the verdict on the token.
  • challenge_ts: the timestamp of the challenge load, in ISO format.
  • hostname: the hostname of the site where the reCAPTCHA was solved, which a server can compare with its own domain.
  • error-codes: optional reasons for a refusal, such as timeout-or-duplicate when the response is too old or has been used previously, or invalid-input-response when it is invalid or malformed.

Why is a token refused although the challenge was passed?

The verification rules point to three causes. Age: the two-minute window is already running when your code receives the token. Reuse: a form sent again after a validation error carries a token that Google has already verified, and the answer is timeout-or-duplicate. Origin: the site checks the token with its own secret and siteverify names the hostname where it was solved, so a token requested for another key or page does not match. The remedy is always a new token, never a second try with the old one.

Where does the reCAPTCHA v2 token go in the page?

Wherever the page itself would have read it. Google documents three ways for a site to obtain the response token, and a token returned by a solver has to arrive through the one the page uses. A field filled in silence is useless if the page waits for a function call.

Which of the three paths does your page use?

How a page reads the reCAPTCHA v2 token, and what to do with a solver’s token
How the page reads the token Typical page What to do with solution.token
The g-recaptcha-response POST parameter A plain HTML form with the checkbox Write the token in that field, then submit the form
A call to grecaptcha.getResponse A form checked by a script before it is sent Find the value that script sends and put the token there
A string argument given to the data-callback function Invisible mode, or a form sent by script Call that function with the token as its argument

What do you send for a reCAPTCHA v2 task, and what comes back?

You send two strings with the task type recaptcha-v2: websiteURL, the address of the page that shows the widget, and websiteKey, the value of its data-sitekey. No image is uploaded. The answer is solution.token, a response token to place in the form.

The reCAPTCHA v2 task at a glance
Item Value
Publisher Google
Challenge family Image grid
Task type recaptcha-v2
You send Site key + page URL
You get back Token to inject
Vendor documentation Google documentation

How do you bypass reCAPTCHA v2 captcha with the ilovecaptcha API?

In five steps, without handling the image grid: the page gives the site key, the API returns the token, your code delivers it.

  1. Read the site key. Copy the data-sitekey value of the g-recaptcha element in the page.
  2. Create the task. POST createTask with the type recaptcha-v2, websiteURL and websiteKey.
  3. Wait for the token. Query getTaskResult every 1 to 2 seconds until status is ready.
  4. Deliver the token. Write solution.token in the g-recaptcha-response field, or pass it to the page’s callback.
  5. Submit at once. Send the form immediately: the token lives 2 minutes and is verified once.

After an error from the site, request a new token: the old one is spent.

What does a reCAPTCHA v2 request look like?

The request below asks for a token for one page. websiteURL is the full address of the page where the widget appears, and websiteKey is its public site key, shown here as a placeholder. Once the task is ready, solution.token holds the response token, shortened in this example: a single string, placed in the form as it is.

POST /createTask
Content-Type: application/json

{
  "clientKey": "YOUR_API_KEY",
  "task": {
    "type": "recaptcha-v2",
    "websiteURL": "https://example.com/login",
    "websiteKey": "6Lc_EXAMPLE_SITE_KEY"
  }
}

→ 200 { "errorId": 0, "taskId": "tsk_8f3a1c2e", "status": "processing" }

POST /getTaskResult
Content-Type: application/json

{ "clientKey": "YOUR_API_KEY", "taskId": "tsk_8f3a1c2e" }

→ 200 { "errorId": 0, "status": "ready", "solution": { "token": "03AFcWeA…" } }
A createTask request for a reCAPTCHA v2 task, then the getTaskResult answer once the task is ready (preview format).

Bypassing reCAPTCHA v2: questions about tokens, keys and grids

Can you bypass reCAPTCHA v2 without solving the image grid yourself?

Yes. reCAPTCHA v2 is a token challenge: the site does not look at which pictures were selected, it only asks Google whether the response token is valid. A solver API can therefore do the visual work elsewhere and return a token for your site key and page URL. What you cannot skip is the last leg: the token must reach the form the way the widget would have delivered it, and the site’s server still verifies it with Google.

Where is the reCAPTCHA v2 site key in a page?

In the markup of the widget. Google’s documentation places it in the data-sitekey attribute of the element that carries the g-recaptcha class. When the page renders the widget by script, it is the sitekey parameter passed to grecaptcha.render. The site key is public. The secret, the key shared between the site and reCAPTCHA, stays on the site’s server and only serves the siteverify call.

How long is a reCAPTCHA v2 token valid, and what does timeout-or-duplicate mean?

According to Google, a response token is valid for two minutes and can be verified only once. The error code timeout-or-duplicate is what siteverify answers when one of those rules is broken: the response is too old or has been used previously. In practice, request the token as the last step before sending the form, keep no token in reserve, and never send one again after a failed submission.

Does invisible reCAPTCHA v2 need a different approach from the checkbox?

Not for the API call: the ilovecaptcha task type covers the invisible variant and takes the same site key and page URL. The difference is in the page, which has no box to tick: Google binds the widget to a button, or to a div that the page triggers with grecaptcha.execute, and passes the token to the function named in data-callback. Delivering a solver’s token therefore means calling that function with the token, not only filling a field.

Are you allowed to automate a form protected by reCAPTCHA v2?

On your own site, yes, and Google provides for it: its FAQ publishes test keys for reCAPTCHA v2 with which the widget always passes and every verification request succeeds, so your automated tests need no solver. On someone else’s site, the answer depends on its terms and on the law that applies to you. ilovecaptcha is meant for work you are authorised to carry out: QA, monitoring, accessibility automation, availability checks, academic research, collection of public data. Credential stuffing, spam and payment fraud, which OWASP lists under OAT-009 CAPTCHA Defeat, are outside what it supports.

Sources

The facts and figures quoted on this page come from these sources.