Twitter Card Validator: How to Test an X Card Preview

X's Card Validator has shown no preview since 2022 and sits behind an X login. Here is what it still does, the composer test that replaced it, and the failures that survive a correct tag set.

Twitter Card Validator: How to Test an X Card Preview

Say you've just shipped a launch page and the link goes out within the hour. You paste the URL into the Twitter Card Validator to check the preview, and you get a login screen.

Logging in won't give you a preview. X removed preview functionality from the Card Validator in mid-2022, and the replacement it recommends is the post composer, where the card renders before you publish: X's wording is that there "should be no need to post the Tweet". The composer sits inside the posting flow, so it needs a session too. That leaves two paths: the composer if you have one, and the checks further down if you don't.

What the validator still does

Two addresses reach the tool, cards-dev.twitter.com/validator and cards-dev.x.com/validator, and both redirect to the same X login page. Signing in, X said in August 2022, gets you a page that inspects a URL's card markup and writes a log. We could not log in to confirm it still does, and it does not draw the card either way.

X kept the tool for two jobs, in its own words from August 2022: "submitting brand new domains, and for using the logs to confirm that cards are accessible or recognised by Twitter on specific URLs", with the note that "previews will no longer be shown there". The previews went because they "were not always aligned with the display of cards on Twitter across different platforms". If you have a new domain and no preview, the log is what you read.

The test that replaced it

X's instruction is to check the preview in the composer itself, "on Twitter.com, or the Twitter for Android or Twitter for iOS apps":

  1. Open the composer on x.com or in the X app.
  2. Paste the link and wait for the card to appear in the draft.
  3. Read it, then close the draft. Nothing is posted.

That preview is X's own, and X describes it as the way to see something that "would accurately reflect the current display of the card on Twitter". The third-party previews we looked at, ours included, are their own renderings built from the same public tags. When one disagrees with the composer, follow the composer.

X also states that cards are not served through the API and may not render in third-party client apps. A bare link in someone else's client is that client's behavior, not necessarily a broken card.

Without an X account the composer is closed, which is our reading of how posting works rather than something we tested signed out. The checks below work regardless, and our social preview tool renders the same URL for X alongside Instagram, Facebook, LinkedIn, WhatsApp, Telegram and Discord. Instagram, X, WhatsApp and Discord need an email verification first; Facebook, LinkedIn and Telegram preview straight away.

What a card is built from

X's minimum is a valid twitter:card tag, or suitable Open Graph fallback tags (X's troubleshooting thread). The og: set is what the other networks read, so it has to be correct whether or not you also write twitter: versions.

<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="Your launch page headline">
<meta name="twitter:description" content="One or two sentences.">
<meta name="twitter:image" content="https://example.com/launch-card.jpg">
<meta property="og:title" content="Your launch page headline">
<meta property="og:description" content="One or two sentences.">
<meta property="og:image" content="https://example.com/launch-card.jpg">
<meta property="og:type" content="website">

twitter:card takes summary, summary_large_image, app or player. If more than one twitter:card value is on the page, the last one in sequence wins, which matters on a WordPress site where a theme and a plugin both write the tag.

As of October 2023, X had stripped headlines from link cards on the web and in its iOS app (TechCrunch), leaving the image and domain on screen. We have not checked what the current client shows, so look at the composer rather than trusting any description, including this one.

Why a card still fails when the tags are right

Correct tags are necessary, not sufficient. These are the remaining failures, from X's pinned troubleshooting thread, last updated in August 2022.

  1. Tags written by JavaScript. "The crawler and validator cannot execute JavaScript and the tags must be static." A single-page app that sets metadata on the client renders a card for nobody. Check the page source rather than the DOM; if the tags are only in the DOM, server-side rendering or a prerendered head is the fix.
  2. An App Card renders as a summary card. X's wording is "As of early 2022, App Cards render as summary cards", so a correctly tagged twitter:card=app no longer gets app-specific treatment. X's docs do not describe a card opening an app; a tap on the card follows the link underneath it. What gets a tap into the app is that link, through Universal Links on iOS and App Links on Android, with a web page carrying the tags as the fallback. Our deep link tester checks whether that URL opens the right screen once it is tapped.
  3. The crawler is Twitterbot, not a browser. Fetch the page the way X's crawler does, following redirects:

curl -sL -A Twitterbot https://example.com/launch/ | grep -iE 'twitter:|og:'

If the crawler can read the page, its tags print here. If it prints nothing while your browser shows the tags, either they are added after load (item 1) or the server is refusing the crawler, and a robots.txt rule or a CDN bot rule is the next thing to check.

Check the image the same way:

curl -sI -A Twitterbot https://example.com/launch-card.jpg

X's checklist asks for "a 200 response code and a valid Content-Type header". A 403, a redirect to an HTML page, or a text/html content type means the crawler is not getting the image. A 405 means your server refuses HEAD requests; drop -I and add -o /dev/null -w '%{http_code} %{content_type}'.

If you would rather not run curl, our social preview tool renders the card from the tags it finds and lists optimization suggestions beside it. We have not checked its user agent, so where X's crawler is blocked the -A Twitterbot check above is the one that will tell you.

  1. robots.txt counts on the image's domain too. X says to allow Twitterbot on your own site, and to "check the robots.txt file for that domain" when images are hosted elsewhere. A stock-photo or CDN domain with a permissive public robots.txt is fine; one that blocks crawlers produces a title with no picture.
  2. The crawler cannot resolve IP addresses or localhost. "The crawler does not support numerical IP addresses as domain references, and cannot access localhost." A staging URL built on an IP, or anything served from your machine, produces no card. Use a public hostname.
  3. The certificate and server name have to match. X lists an SSL mismatch as a fetch failure, and the certificate and server name must match or be aliased to match.
  4. Two plugins writing the same tags. "Avoid using multiple plugins at the same time, as tags will override one another." On WordPress, two SEO plugins mean duplicate twitter:card and og:image tags, and X warns that the tags will override one another. For twitter:card specifically, X says the last value in sequence takes priority.
  5. Two error messages that mislead. The "not whitelisted" error almost certainly means the tool could not find twitter:card markup rather than that you need approval, and cards have not required approval since early 2018. "No metatags found" is "probably a result of an error fetching the page", which X says may be a host blocking its IP range.

Why a fix can take up to 7 days

Cards data is "cached for up to 7 days before being refreshed", and that clock starts once a link to the page has been published in a post. A post you published before the fix can keep showing the old card for up to a week.

X describes one lever, run from the validator itself: adding a unique parameter to the URL acts as a "hint" to the cards crawler to revisit your site. The same passage warns that "in many cases there may be a delay" before new metadata is reflected, and the validator now needs a login and shows no preview.

Checking the image

Property summary_large_image summary
Aspect ratio 2:1 1:1
Minimum 300 x 157 144 x 144
Maximum 4096 x 4096 4096 x 4096
File size under 5 MB under 5 MB
Formats JPG, PNG, WEBP, GIF JPG, PNG, WEBP, GIF
SVG not supported not supported
Crop not documented cropped to a square

The large-image column is from X's large-image card documentation and the summary column from its summary card documentation, both archived copies; the live pages now redirect to docs.x.com. An animated GIF uses only its first frame.

The image URL has to be absolute and include the protocol. A relative path is not a URL the crawler can fetch, and nothing in the browser will show you the problem, which is why a card with a title and no picture is worth checking here first.

1200x630 is the size GitHub's card image and ours use. It is 1.905:1. X writes 2:1, but its own minimum of 300x157 works out at 1.911:1, and 1200x630 sits in almost the same place. X does not document how it crops the large image.

FAQ

Why does my card have a title but no image?

The image URL is relative, blocked, returning something that is not an image, or outside the limits for its card type: below 144x144 for a summary card, below 300x157 for summary_large_image, over 5MB in either case, or an SVG, which X does not support. Check that it is absolute, returns 200, and is reachable by Twitterbot. Our social preview tool renders the card it builds from your tags and lists optimization suggestions before you share it.

Which card type should I use for a launch page?

summary_large_image when the image is meant to carry the card, which is the case for a launch page or a blog post; summary when you want a small square thumbnail beside the text. app no longer gets app-specific treatment (item 2 above), and player is for a page that hosts a video or audio player.

Where to go next

  • Paste the link into the composer and read the card there before the first post.
  • Paste the URL into our social preview tool to see the card rendered and the suggestions listed.
  • Run curl -sL -A Twitterbot <url> | grep -iE 'twitter:|og:' and compare the output with your page source.
  • Fetch the image with curl -sI -A Twitterbot <image-url> and check it against the spec for its card type.
  • For the same URL on the other networks, our link preview checker guide covers how each one reads the same tags.