img alt Presence Checker
Checks whether a parsed img has an alt attribute and whether its value is empty. Empty alternative text can be appropriate for decorative images; this is a presence check only.
Description
An image’s alternative text conveys its purpose when visual content is unavailable.
An image’s alternative text conveys its purpose when visual content is unavailable. An explicitly empty alt can be appropriate for a decorative image and differs from an absent attribute.1
Checks whether a parsed img has an alt attribute and whether its value is empty. Empty alternative text can be appropriate for decorative images; this is a presence check only.
When to use img alt Presence Checker
Use this for the following task: Checks whether a parsed img has an alt attribute and whether its value is empty. Empty alternative text can be appropriate for decorative images; this is a presence check only.
Prepare the parsed attribute values, element states or ordered local lists requested below. Keep attribute presence separate from value.
How to use img alt Presence Checker and understand its results
- Prepare the parsed attribute values, element states or ordered local lists requested below. Keep attribute presence separate from value.
- Enter hasAlt, alt using the field table, then run the tool.
- Read present, emptyAlternative. Interpret flags, units, ordering and placeholder values using the rules below.
- Review any reported issue or failed check, correct the supplied values when appropriate, and verify the result in its intended context.
| Input field | Meaning | Value type and bounds | Requirement |
|---|---|---|---|
| hasAlt | Has Alt | boolean | Required |
| alt | Alt | string; maximum text length 100000 | Required |
Supply parsed attribute presence separately from its value. Only an exactly empty value counts as emptyAlternative.2
present = hasAlt; emptyAlternative = hasAlt AND alt.length == 0 This summarizes the declared operation. Units, indexing, inclusivity and exceptional cases are explained in the surrounding text.
| Output field | Meaning | Value type |
|---|---|---|
| present | Present | boolean |
| emptyAlternative | Empty Alternative | boolean |
{
"input": {
"hasAlt": true,
"alt": "Map of the campus"
},
"output": {
"present": true,
"emptyAlternative": false
}
} Limitations and assumptions
This does not judge text quality, decorative intent or accessibility conformance; whitespace-only alt is not exactly empty.
This evaluates supplied local information; it does not fetch a page or run a browser. Malformed requests produce input errors. A successfully evaluated request can still contain false flags, empty result lists or a result outside the supplied threshold; those outcomes have the meanings stated above.
Alternative or Complementary methods
Choose label for=id Binding Check for this operation: Resolves explicit label for binding from document-order IDs and labelability flags. An explicit for attribute uses the first matching ID; a nonlabelable first match prevents binding to a later duplicate. For a complementary task, use Open Graph Required Tags Check for this operation: Finds missing Open Graph basic metadata properties in supplied parallel property and content vectors. Requires nonempty content; it does not fetch images or validate URLs.
Further background: HTML / accessibility reference: img alt Presence Checker.
References
-
HTML / accessibility reference: img alt Presence Checker — WHATWG
-
img alt Presence Checker — tool.io
Similar or alternative tools
- label for=id Binding Check
Resolves explicit label for binding from document-order IDs and labelability flags. An explicit for attribute uses the first matching ID; a nonlabelable first match prevents binding to a later duplicate.
- Open Graph Required Tags Check
Finds missing Open Graph basic metadata properties in supplied parallel property and content vectors. Requires nonempty content; it does not fetch images or validate URLs.