GO-V.ORG
As seen in

SpeechRecognitionAlternative: confidence property

Web Speech API

Web Speech API

The **`confidence`** read-only property of the SpeechRecognitionAlternative interface returns a numeric estimate of how confident the speech recognition system is that the recognition is correct.

## Value

A number between 0 and 1, where higher values mean the recognition system is more confident.

## Examples

This code is excerpted from our
[Speech color changer](https://github.com/mdn/dom-examples/blob/main/web-speech-api/speech-color-changer/script.js) example.

```js
recognition.onresult = (event) => {
const color = event.results[0][0].transcript;
diagnostic.textContent = `Result received: ${color}.`;
bg.style.backgroundColor = color;
console.log(`Confidence: ${event.results[0][0].confidence}`);
};
```

## Specifications

## Browser compatibility

## See also

- [Web Speech API](/docs/Web/API/Web_Speech_API)

source: MDN Web Docs mirror · page

Cite this

"SpeechRecognitionAlternative: confidence property". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognitionAlternative/confidence

JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy

Save to pass ·