To add HTML code on a Wix website, open the editor, click the "+" button on the left toolbar, go to "Embed & Social," select "Custom Embeds," and choose "Embed a Widget." Paste your HTML into the code box and click "Update." That is the fastest method, but Wix actually offers three different ways to add custom code depending on what you need.
This guide walks through each method step by step, with real examples you can copy, a breakdown of Wix's HTML limitations, and fixes for common problems.
Method 1: Add HTML With the Embed a Widget Element
The Embed a Widget element is the most common way to add HTML code on Wix. It places a sandboxed iframe on your page where custom HTML, CSS, and JavaScript run independently from the rest of your site. This is the right choice for embedding maps, forms, third-party widgets, or any self-contained HTML block. One of the most common uses is embedding YouTube videos on Wix using iframe code.
Step 1: Log Into Your Wix Account and Open the Editor

Go to Wix.com and sign in. From your dashboard, select the site you want to edit and click "Edit Site" to open the Wix Editor. If you are new to the platform, you can follow our full guide to designing a website with Wix first.
Step 2: Add the Embed a Widget Element
![]()
Click the "+" icon on the left-side toolbar. In the menu that opens, select "Embed & Social," then "Custom Embeds," and finally "Embed a Widget." A placeholder box will appear on your page. Drag it to the position where you want your HTML content to show up.
Step 3: Paste Your HTML Code

Click the widget, then click "Enter Code." The code editor panel opens. Select "HTML" from the code type dropdown (you can also choose "URL" if you want to embed a page by its web address). Paste or type your HTML. Here is a simple example that embeds a Google Map:
You can include inline CSS within a
tag and JavaScript within a tag inside the same code block. Everything runs inside the widget's iframe.
Step 4: Click Update and Preview

Click "Update" to save your code. The widget will reload and display your HTML content. Use the Preview button at the top right of the editor to see how it looks on a live page. Once you are satisfied, publish the site.
Method 2: Add Custom Code Site-Wide (Head, Body, or Specific Pages)
If you need code to run across every page of your site, such as a Google Analytics tracking snippet, a Facebook Pixel, or a custom CSS override, the Embed a Widget method is not ideal because you would have to add it to each page individually. Instead, use Wix's custom code injection feature in your site settings.
How to Add Site-Wide Code
- In the Wix Editor, click "Settings" in the top menu bar (or go to your Wix Dashboard and find "Custom Code" under "Settings").
- Select "Custom Code" from the left sidebar.
- Click "+ Add Custom Code."
- Paste your code snippet into the text box.
- Give it a name (for example, "Google Analytics").
- Choose where to place the code: Head, Body - start, or Body - end. Most tracking scripts go in the Head section.
- Choose whether to load it on all pages or only specific pages.
- Click "Apply."
This is the correct approach for analytics tags, chat widgets, retargeting pixels, and any script that should fire globally. It is also useful for adding a custom CSS stylesheet that overrides default Wix styling across your entire site.
Example: Adding Google Analytics
Replace G-XXXXXXXXXX with your actual Measurement ID from Google Analytics.
Method 3: Wix Velo for Advanced Custom Code
For users who need deeper control, Wix Velo (formerly Corvid) is Wix's built-in development platform. Velo lets you write frontend and backend JavaScript that interacts directly with Wix page elements, databases, and APIs. Unlike the Embed Widget, Velo code is not sandboxed in an iframe; it runs as part of the page itself.
Velo is the right choice when you need to:
- Dynamically change page content based on user actions or database queries
- Build custom forms that write directly to Wix databases
- Call external APIs and display the results on your page
- Add event handlers to Wix page elements (buttons, inputs, repeaters)
To enable Velo, click "Dev Mode" in the top menu bar of the Wix Editor and toggle it on. A code panel appears at the bottom of the editor where you can write JavaScript for each page or create backend modules.
Velo has a learning curve, but it is far more powerful than the Embed Widget for anything that needs to interact with Wix's own elements and data. Check our Wix Velo review for a detailed breakdown of what you can build with it.
What You Can Add With HTML on Wix: Practical Examples
Here are common use cases for adding HTML code on Wix:
- Google Maps: Embed an interactive map using an iframe from Google Maps' "Share or embed map" option.
- Third-party forms: Paste embed code from Typeform, JotForm, or Google Forms to add forms that go beyond what Wix's built-in contact forms offer.
- Social media feeds: Embed Instagram, Twitter/X, or Facebook feeds using their official embed codes.
- Custom countdown timers: Add HTML/CSS/JS countdown timers for product launches or events.
- Pricing tables: Build custom-styled pricing comparison tables with HTML and CSS.
- Chat widgets: Add live chat tools like Tawk.to, Crisp, or Drift via their embed snippets.
- Custom CSS styling: Override default Wix styles by injecting CSS through the site-wide custom code method.
- Analytics and tracking: Add Google Analytics, Meta Pixel, Hotjar, or other tracking scripts globally.
Wix HTML Limitations You Should Know
Before adding HTML code on Wix, be aware of these platform-specific constraints:
- Sandboxed iframes: The Embed a Widget element loads your code inside an iframe. Your HTML cannot access or modify other elements on the Wix page outside that iframe. Communication between the iframe and the parent page requires
postMessage(). - No direct DOM access: You cannot use JavaScript to select or manipulate Wix elements (headers, buttons, menus) from an HTML widget. For that, you need Wix Velo.
- HTTPS required: All external resources (scripts, stylesheets, images, iframes) loaded within your HTML must use HTTPS. HTTP links will be blocked by the browser's mixed-content policy.
- Size constraints: The Embed Widget has a fixed container size on the page. If your HTML content is taller than the widget box, it will scroll internally rather than expanding the page. Resize the widget manually in the editor to fit your content.
- No server-side code: The Embed Widget only supports client-side HTML, CSS, and JavaScript. If you need server-side logic, use Velo's backend modules instead.
- Premium plan may be required: Some custom code features, including site-wide code injection via Settings, are only available on paid Wix plans.
Troubleshooting Common HTML Issues on Wix
Even with correct code, things can go wrong. Here are the most common problems and how to fix them.
HTML Code Not Displaying
If your code does not appear after clicking Update, check these causes in order:
- Syntax errors: A missing closing tag like