Twitter (X) Embed Code Generator
Paste a post URL or a username and get the HTML that X renders on your site. Choose the theme, hide the parent conversation or media, set the language, and copy the code.
Embed code
Paste a post URL or username to get the code.
- Posts, timelines and follow buttons
- Light and dark themes
- Privacy options (dnt)
- Nothing leaves your browser
How to get the embed code for a tweet
- Choose what to embed. A single post, a profile timeline (the account's latest posts) or a follow button.
- Paste the URL or username. Any x.com or twitter.com post link works, including mobile and "i/web/status" links. For timelines and buttons, the username is enough.
- Set the options and copy. Theme, conversation, media, language, width and the do-not-track flag. Paste the HTML where you want the embed; X's widgets.js turns it into the live card on page load.
What each option changes
| Option | Attribute | Effect |
|---|---|---|
| Theme | data-theme="dark" | Dark card. Default follows X's light theme, not the visitor's system setting. |
| Hide conversation | data-conversation="none" | Shows only the post, not the one it replies to. |
| Hide media | data-cards="hidden" | Text only: no photos, videos or link previews. |
| Width | data-width | 250 to 550 px; the card is responsive below that. |
| Language | data-lang | Language of the card's labels ("Reply", "Copy link"), not of the post. |
| Do not track | data-dnt="true" | Asks X not to use the embed for ad personalisation. Keep it on for GDPR sites. |
Embeds and page speed
Each embed loads X's widgets.js plus the post's media, which costs several hundred kilobytes and a few requests. Three tips: put the script tag once at the end of the page rather than after every blockquote (the tool includes it once per copy), lazy-load embeds below the fold by inserting the script only when the section scrolls into view, and for pages with many quotes consider screenshots with alt text plus a link, which is what most news sites do now.
Privacy and consent banners
The widget sets cookies from X's domain, so sites that need consent should load the script only after the visitor accepts. The "No script" output gives you a blockquote that renders nothing from X until your consent manager injects widgets.js, at which point the cards light up on their own.
Embed Code Generator: FAQ
How do I embed a tweet on my website?
Paste the HTML the tool gives you into your page: a blockquote with the post link, followed by the widgets.js script tag. When the page loads, the script replaces the blockquote with the interactive post. The blockquote also works as a plain fallback if the script is blocked.
Can I embed a tweet without JavaScript?
Partly. Leave out the script tag and the blockquote stays as plain text with a link to the post, which is accessible and loads nothing from X. You lose the card styling, media and live counts. The tool has a "No script" option that outputs only the blockquote.
Why does the embed show a different post above mine?
If the post is a reply, X shows the parent by default. Set "Hide conversation" to show only the post you chose; it adds data-conversation="none" to the blockquote.
Does the embed work with x.com links?
Yes. X's widgets.js accepts both twitter.com and x.com status URLs. The tool keeps the host you pasted; both render the same card.
How do I embed a Twitter timeline?
Use the Timeline tab with the username. The output is an anchor with class twitter-timeline plus the script; you can set a fixed height, hide the header and footer, and choose light or dark. Timelines only show public accounts.
Can I embed a deleted or private post?
No. The embed loads the post live from X, so a deleted or protected post renders as an empty blockquote with the link. If you need to keep a record of a post, screenshot it or use our Tweet Generator to recreate it as an image.
More free X tools and guides
- Click to Tweet Generator: share and follow links without the widget
- Tweet Generator: recreate a post as an image when the embed cannot load
- Tweet URL to ID: get the ID and post date from any link
- Twitter Video Downloader: save a video instead of embedding it
- Why Am I Losing Followers on X?: nine reasons and the fix for each