Guides · Updated 2026-12-04
How to test Open Graph tags before you deploy
The worst time to find a broken link preview is after you have shared the link. Platforms cache what they see on the first fetch, so a bad first impression can stick for days. Testing your Open Graph and Twitter Card tags before launch avoids that.
The difficulty is that preview crawlers cannot reach localhost or a password-protected staging site, and the old standalone validators do not all exist any more. This guide shows a practical way to check your tags at each stage, from your editor to the live page.
Stage 1: read your own HTML
The cheapest test needs no tools at all. Load the page, choose View Source and look at the head. You are checking that the tags exist in the server-sent HTML, not only in the inspector, since crawlers do not wait for scripts. You can also fetch the page with curl and search the output.
curl -s https://example.com/ | grep -i -E "og:|twitter:"What to look for
A short list covers nearly every mistake.
- og:title, og:description, og:image and og:url are all present.
- og:image is an absolute https address that returns an image.
- twitter:card is set to summary_large_image if you want the wide card.
- There is exactly one set of tags, with no duplicates from a plugin or theme.
- og:url matches the canonical URL of the page.
- Text lengths are sensible. Very long titles and descriptions are truncated.
Stage 2: check the image itself
Open the og:image address by itself. It should load with no redirect and no login, at a reasonable file size, and the content should look right when cropped. Our size reference lists the recommended dimension for each platform. Look at the image shrunk to the width of a phone chat bubble, because that is how most people will see it, and check that the text is still readable.
Stage 3: make localhost reachable
Crawlers run on the public internet, so they cannot read http://localhost:3000. To test the real fetch path you need a public address that points at your machine. A tunnelling tool gives you a temporary https URL that forwards to your local server. Tools such as Cloudflare Tunnel or ngrok do this in one command.
Share that temporary URL with the platform debuggers described below. Remember to turn the tunnel off afterwards, and note that the cached preview belongs to that temporary URL, not to your final domain, so you will get a fresh fetch when you launch.
# example with Cloudflare Tunnel
cloudflared tunnel --url http://localhost:3000Stage 4: use the official debuggers
Each major platform offers a tool that shows exactly what it sees and lets you refresh its cache. These are the most reliable way to check, because they use the real crawler.
- Facebook: the Sharing Debugger shows the parsed tags, warnings and the cached image, and has a Scrape Again button.
- LinkedIn: the Post Inspector fetches the page and clears the cache.
- X: the standalone Card Validator was retired, so check by starting a post with the link and viewing the preview in the composer.
- Slack, Discord and WhatsApp have no debugger. Send the link to yourself in a private channel or chat and look at the result.
Stage 5: test on staging with the same setup as production
A staging site often behaves differently from production. It may be behind a password, may block bots, may use a different domain in og:url, or may carry a noindex header. If your staging pages return a login wall to a crawler, you cannot test previews there. Either allow the crawler through for the test, or use the tunnel approach against a local build.
Make sure the production build uses the production domain in every absolute URL. A common slip is leaving a localhost or staging host in og:image, which then works for you and breaks for everyone else.
Stage 6: after launch, re-scrape once
Once the page is live on its real domain, run the Facebook and LinkedIn tools one time. This primes their caches with the correct data and gives you a final confirmation. Then share the link in a private message to confirm the preview, before you post it publicly.
If you update the image later, remember that platforms keep the old one. Re-scrape, or change the image file name so the address is new.
A pre-launch checklist
Copy this into your release notes.
- View Source shows all Open Graph and Twitter tags.
- og:image is absolute, https and loads in a private window.
- Image looks right at phone size and is under 1 MB.
- No duplicate tags, and og:url equals the canonical URL.
- Facebook and LinkedIn debuggers show the expected card.
- A test share in a private chat looks correct.
Was this guide helpful?
Questions
How do I test Open Graph tags on localhost?
Use a tunnel such as Cloudflare Tunnel or ngrok to expose your local server at a public https URL, then run the platform debuggers against it.
Is there still a Twitter Card Validator?
The standalone validator was retired. Start a post with your link and check the preview in the composer instead.
Why does the preview look different on each platform?
Each platform crops and styles the card in its own way and reads slightly different tags. Check the main ones you care about.
Try it
More guides
- How to add a favicon to your website
- Favicon formats: ICO vs PNG vs SVG
- The Apple touch icon: size, format and common problems
- Favicon not showing or not updating: nine fixes
- Maskable icons explained: the safe zone and how to use it
- The web app manifest: what each field does
- How to design a favicon that is readable at 16 pixels
- How to get your favicon to show in Google Search results
- Open Graph image not showing: a checklist that finds the cause
- Favicon setup in Next.js, Vite and React