To embed YouTube Live Chat on your website, use YouTube’s live-chat URL in an iframe, with the stream’s video ID and the hostname of the page that contains the iframe. The hostname must match the page host exactly; it is not the page’s path.
This approach displays YouTube’s chat interface alongside your site content during an active live event. It is separate from embedding the video player, and YouTube says the chat embed is unavailable on mobile web.
Find the stream’s video ID
Start with the YouTube watch-page URL for the live stream. In a URL such as https://www.youtube.com/watch?v=12345, the video ID is the value after v=: 12345. Your real ID will be a different string; copy it from the address of the specific broadcast you want people to discuss.
The ID identifies the stream, not your channel. A channel may host many broadcasts, so a channel ID or channel URL is not a substitute. If you have several scheduled or active events, check the watch page for the one whose chat you intend to show.
The iframe URL needs this video ID as the value of its v parameter. A mistyped ID may point the embed at the wrong event or prevent the expected chat from appearing. When in doubt, open the stream’s watch page and copy the value again rather than relying on an older note or a different broadcast’s URL.
YouTube’s Live Chat help instructions describe the iframe approach and identify the video ID as one of its inputs. The procedure concerns a live stream, so do not assume that the same URL will provide chat for an ordinary video or a replay. The reviewed guidance does not establish that use.
Identify the page hostname
Next, identify the exact host of the page where the chat iframe will appear. For example, if the page address is https://www.example.com/youtube_chat, the hostname is www.example.com. The path, /youtube_chat, is not part of the hostname.
This distinction matters because YouTube’s URL pattern puts the hostname into the embed_domain value. Use the host serving the actual page, not the site’s brand name, a URL path, or the address of a different page. If visitors open the page at www.example.com, use that host even if the page itself is nested below it.
Pay attention to the visible form of the address. www.example.com and example.com are different hostnames. If your site uses a subdomain such as live.example.com, that is the host to enter for a page on that subdomain. Do not guess based on redirects or the address you expect users to type; check the final address in the browser where the page is served.
A practical way to avoid confusion is to write down the complete page URL first, then separate it into parts: scheme (https), hostname (www.example.com), and path (/youtube_chat). Only the hostname goes into embed_domain. This keeps the input aligned with YouTube’s example and avoids accidentally placing a slash or page name in the host value.
This is a small detail with a direct consequence. YouTube’s help page says the embedded chat will not open when the specified embed domain and page domain differ. Treat hostname matching as part of the setup, not as a cosmetic choice.
Build YouTube’s Live Chat URL
Combine the two values in YouTube’s documented pattern:
https://www.youtube.com/live_chat?v=12345&embed_domain=www.example.com
Here, replace 12345 with your stream’s video ID and www.example.com with the hostname of the page that contains the iframe. Keep the rest of the URL structure as shown. The v parameter identifies the broadcast; embed_domain identifies the page host YouTube expects.
For a site page at https://live.example.org/events/morning, for instance, the hostname value would be live.example.org, not live.example.org/events/morning. The path tells a web server which page to serve, but it does not belong in the embed_domain value. This example illustrates how to read the address; use your own final page host and stream ID.
Before adding the URL to your site, inspect the two values character by character. Check that the ID came from the intended watch page, and that the hostname has the same subdomain form as the page. Do not add speculative query parameters: the documented pattern needed for this embed is the video ID and matching host value.
Add the chat iframe to the page
Set the URL you built as the iframe’s src. A minimal illustrative snippet is:
<iframe
src="https://www.youtube.com/live_chat?v=12345&embed_domain=www.example.com">
</iframe>
Replace both example values before publishing. The snippet shows the essential connection between the URL and the page; it is not a promise about a particular layout, sizing, or website-builder interface. YouTube’s reviewed help guidance specifies the URL and iframe method, not a responsive styling recipe.
Add this iframe to the page that has the hostname you placed in embed_domain. If your site editor has an HTML or embed block, that is where you would typically put the iframe markup, though the editor’s labels and restrictions depend on the platform. Some site tools accept a URL directly and generate an iframe; if so, enter the complete live-chat URL and verify that the final page uses the expected host.
Keep the chat iframe distinct from the video player embed. If you also want to show the live video, that player is a separate element with its own embed code. YouTube’s live-stream guidance distinguishes chat on the watch page from an embedded player: chat is available on YouTube watch pages, not automatically inside an embedded player. Adding the player alone does not add the chat panel to your website.
If you are planning the page around a video and chat side by side, decide where each element belongs in the page editor, then test the published page rather than relying only on an editor preview. A preview may use a different host or a restricted editing frame. The decisive check is whether the published page’s actual hostname matches the value in embed_domain.
Match the hostname exactly
The host match is the most easily overlooked part of this embed. The value after embed_domain= must be the hostname of the page on which the iframe is rendered. A URL path is not a host, and a similar-looking hostname is not an exact match. If the configured value differs from the page host, YouTube says the chat will not open.
Use the final address in the browser as your reference. For example, if visitors land on https://www.example.com/community/live, enter www.example.com. If they instead land on https://community.example.com/live, enter community.example.com. In either case, leave off the scheme and path in the parameter value.
A domain can have more than one working address. A site may answer on both a www hostname and a version without www, or direct visitors from one to the other. Do not assume that because both addresses reach similar content, either value will work for the embedded chat. Configure the embed_domain value for the hostname of the page actually containing the iframe, then test that version of the page.
This is especially worth checking when a site editor publishes a page under a preview address, a temporary subdomain, or a separate hostname from the main site. A chat URL prepared for the main site should not be treated as interchangeable with one placed on a distinct host. If the page moves, re-check the iframe URL against the new host.
Test the embed during a live stream
Test while the intended event is live. YouTube’s Live Streaming API documentation describes chat as associated with an active live event and says it is no longer available for that event after it ends. The chat iframe is therefore not a static page element that you can validate fully against a finished broadcast.
Open the published page at its real address and check whether the chat appears. Confirm that the stream is active, the video ID belongs to that stream, and the visible page hostname matches the embed_domain value. If you have embedded the player too, inspect the chat separately; the player appearing does not prove that the chat iframe is set up correctly.
Ask someone to check from a desktop browser as well as checking it yourself. YouTube Help says embedding Live Chat is not available on mobile web, so a phone browser is not a suitable test of whether the desktop embed has been configured correctly. That limitation concerns the chat embed, not whether your site can otherwise be viewed on a phone.
For an always-on channel, a live page may be part of a broader viewing experience, but the chat still follows the lifecycle of the live event. If you are planning the broadcast itself, the guide to running a YouTube live loop for a Kannada devotional music channel covers the separate job of keeping a channel’s video live. Chat setup does not make a broadcast run continuously.
Troubleshoot host and URL mistakes
When the chat does not appear, begin with the inputs rather than changing unrelated page settings. Re-open the stream’s watch page and verify the video ID. Then inspect the URL in the iframe and compare the embed_domain value with the hostname in the browser address bar for the page containing it.
| What to check | Common mistake | What to do |
|---|---|---|
| Video ID | Using a channel ID or an ID from another broadcast | Copy the value after v= from the intended stream’s watch-page URL |
| Host value | Including /page-name or a trailing path |
Keep only the page hostname in embed_domain |
| Host variant | Using example.com when the page is on www.example.com, or the reverse |
Use the exact hostname shown for the published page |
| Event status | Testing after the live event has ended | Test during the active event |
| Device | Judging the embed only from mobile web | Check from desktop web, where YouTube’s documented embed is available |
| Player versus chat | Expecting an embedded video player to include chat | Add and verify the live-chat iframe separately |
Do not try to solve a host mismatch by adding more URL parameters or changing the path. The documented setup uses a matching host value, and the help source specifically warns that a mismatch prevents the chat from opening. Return to the page address, separate host from path, and correct the value.
If the page is behind a site-builder preview or is being viewed through a temporary address, publish or open the intended final page and check that address. If the final hostname changes later, update the parameter and test again. Avoid diagnosing this solely from how the page looks inside the editor.
For readers who want to display messages in a custom interface rather than show YouTube’s chat panel, the Live Streaming API is a separate development route. Google documents liveChatMessages.list and liveChatMessages.streamList; the broadcast’s snippet.liveChatId identifies its chat, and the API reference recommends the streaming method for lower-latency message delivery rather than repeatedly polling. That requires an application implementation, not a different iframe setting. The LiveChatMessages API reference and streamList method documentation are the primary sources to review before taking that route.
If your wider concern is keeping a broadcast online rather than embedding its discussion, compare the operational trade-offs in cloud options for always-on YouTube channels and ways to reduce the cost of a 24/7 live stream. Those are adjacent decisions; neither changes the chat iframe’s host requirement. For a prerecorded channel where you want the broadcast to continue without leaving your own computer running, StreamNeo removes that specific always-on operating burden, while the website chat still needs its own correctly configured iframe.
Before committing, compare the operating options on the pricing page. When the file and channel are ready, start free — 24-hour trial, no card.
FAQ
What do I put in embed_domain?
Put the hostname of the page containing the iframe, such as www.example.com. Do not include https:// or a path such as /youtube_chat. The value must match the actual page host.
Can I put the chat inside the YouTube video player embed?
The chat iframe and the video player embed are separate elements. YouTube’s guidance says live chat is available on watch pages, not on embedded players, so embedding the player does not add chat automatically. Add the chat iframe separately if you want it on your website.
Will the chat iframe work after the stream ends?
YouTube’s API documentation says live chat is available while the live event is active and no longer available for that event after it ends. The documented embed pattern is for a live stream, so do not assume it provides chat for a replay or an ordinary video.
Why can’t I see the embed on my phone?
YouTube Help says embedding Live Chat is unavailable on mobile web. Check the published page from a desktop browser while the event is active, and verify the video ID and exact hostname if it still does not appear.