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

  1. Prepare the parsed attribute values, element states or ordered local lists requested below. Keep attribute presence separate from value.
  2. Enter hasAlt, alt using the field table, then run the tool.
  3. Read present, emptyAlternative. Interpret flags, units, ordering and placeholder values using the rules below.
  4. Review any reported issue or failed check, correct the supplied values when appropriate, and verify the result in its intended context.
Input fieldMeaningValue type and boundsRequirement
hasAltHas AltbooleanRequired
altAltstring; maximum text length 100000Required

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 fieldMeaningValue type
presentPresentboolean
emptyAlternativeEmpty Alternativeboolean
json
{
  "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

  1. HTML / accessibility reference: img alt Presence Checker — WHATWG

  2. 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.

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies