Viewing and downloads · Guide

How to Embed an X Post on a Website (or Use a Screenshot)

Short answer

To embed an X post, open the post's share or more menu, choose the embed option to get the code from publish.x.com, and paste that blockquote and script into your page's HTML; use a screenshot or mockup instead when the post might be deleted, when the page must load fast, or when you need a fixed image.

Key takeaways

  • The official embed is a short blockquote plus X's widgets.js script.
  • If the author deletes the post, the embed falls back to plain quoted text.
  • Embeds resize to their container between 220 and 550 pixels wide.
  • Rich-text editors often strip the script, which leaves only the plain-text fallback.
  • Screenshots never change and load instantly, but they aren't live or clickable.

You can put an X post on a website in two ways: embed the real post with X's code, or show an image of it. Embedding keeps the post live, clickable and attributed. An image is faster and never changes. This guide covers how to embed properly and when the image route is the better call.

How do I embed an X post?

Copy the embed code from publish.x.com and paste it into your page's HTML.

  1. Open the post on x.com in a browser.
  2. Open the post's menu (the three dots or the share icon) and choose the embed option. It sends you to publish.x.com with the post's code.
  3. Adjust options if you want, such as the color theme.
  4. Copy the code.
  5. Paste it into your page in HTML or code mode.

The code is two parts. A <blockquote> holds the post's text, author and date as plain HTML. A <script> tag loads X's widgets.js, which replaces the blockquote with the styled, interactive post. You can also skip the menu and paste any post URL into publish.x.com.

How do I embed in WordPress or another CMS?

Use an embed block or HTML mode, not the visual editor, so the script survives.

Platform What to do
WordPress (block editor) Paste the post URL on its own line, or use the Custom HTML block with the embed code
Squarespace, Wix and similar Use their code or embed block and paste the full snippet
Static HTML site Paste the blockquote where the post goes; load widgets.js once near the end of the page
Email newsletters Embeds don't run in email; use an image linked to the post

X's documentation notes the most common problem: the post shows as plain text because the editor stripped the script. If you embed often, add widgets.js to your site template once, and paste only the blockquotes in posts.

What happens if the post is deleted later?

The live version disappears, and readers see the plain blockquote text that was in your code.

That fallback text is a snapshot from when you copied the code. It keeps the quote readable, but the styling, media and engagement counts are gone. For articles that need to stay accurate years later, quote the important words in your own text as well, with the date and author.

Protected posts can't be embedded at all, and a post that becomes protected later stops rendering.

Do embeds slow a page down?

Each embed loads X's script and content from X's servers, which adds weight and third-party requests.

One or two embeds are fine on most pages. A page with twenty becomes slow to load and jumpy as each post renders in. Some site owners also block widgets.js until a visitor accepts third-party content, for privacy reasons. If speed or privacy matters, a static image with a link to the original is the lighter choice. Embeds also adapt to their container, between 220 and 550 pixels wide according to X's documentation, so leave room in narrow sidebars.

Can I change how the embed looks?

Yes, within limits: you can pick a light or dark theme and hide the media and the parent post in a conversation.

The options on publish.x.com set attributes on the blockquote. A dark theme suits dark sites. Turning off cards and the conversation view gives every embed a consistent height, which X's documentation describes as basic formatting: the text, the author, a timestamp and the post actions. That's useful in a list of several embeds, where one post with a large video would otherwise push everything down. You can't restyle the inside of the embed with your own CSS, because it renders in a frame controlled by X.

When is a screenshot better?

When you need a fixed record, a fast page, an email, a slide or print.

A screenshot keeps exactly what the post looked like when you captured it. That matters for news and research, where a post might be edited or deleted. Screenshots also work everywhere: email, PDFs, slides, social media and printed handouts.

The tradeoffs: screenshots aren't clickable, include whatever clutter was on screen, and can look blurry when resized. To share a post you captured, our guide to downloading images from X covers getting media at full quality.

When should I use a mockup instead?

When the post doesn't exist yet, or when you need a clean, controlled image for design or teaching.

Designers draft launch posts before they're published, presenters want a readable post on a slide without real people's replies, and teachers need examples that don't expose real accounts. That's what our fake tweet generator is for. It draws the post in your browser, keeps a small MOCKUP label on by default, and exports a sharp PNG at up to 3x. For a full timeline look, the timeline post mockup shows the post in context.

Never present a mockup as a real post someone made. If you're showing what a real account said, embed or screenshot the original and link to it.

Questions people ask

How do I get the embed code for an X post?

On x.com, open the post's menu and choose the embed option, which takes you to publish.x.com with the code ready to copy. You can also paste the post's URL into publish.x.com directly.

Why does my embedded post show only text?

Usually the script tag was removed. Many content editors strip scripts when you paste HTML. Switch to the HTML or code view, or add X's widgets script to your site template once.

What happens to an embed if the post is deleted?

X's widget no longer renders it. The fallback blockquote, with the text and link that were in the code, stays on your page.

Can I embed a post from a protected account?

No. Only public posts can be embedded.

Sources

  1. Embedded posts FAQ (X developer documentation)
  2. Set up X for Websites (X developer documentation)
  3. Publish (X embed code generator)