How To Add HTML Code In Shopify
Last modified: November 2, 2026
Also available in: Deutsch · Español
-
What are the best practices for backing up my Shopify store before making HTML changes?
Duplicate your theme before you touch any code. Go to Online Store, then Themes, click the … button on your theme and choose Duplicate, then edit the copy. Shopify also saves older versions of a theme, so if a live change breaks something you can open the same … menu and roll back from the theme version history.
-
Where can I add custom HTML code in my Shopify store?
You can add custom HTML code in several places on your Shopify store, including within the theme files (e.g.,
theme.liquid), custom HTML sections, pages, blog posts, and product descriptions. You can also use the rich text editor to insert HTML directly into content areas. -
How do I add HTML code to a specific page in Shopify?
Open the page in your Shopify admin, click the <> Show HTML button in the content editor, and paste your code there. One catch: the editor removes script, style and iframe tags when you save, so for anything interactive use a Custom Liquid section instead.
-
Can I add HTML code to my Shopify theme files?
Yes, you can add HTML code directly to your Shopify theme files by accessing the “Edit code” section under “Themes.” You can modify templates like
theme.liquid,header.liquid,footer.liquid, or create custom sections where you can insert your HTML. -
How do I embed third-party HTML code, like a widget or iframe, in Shopify?
To embed third-party HTML code, such as a widget or iframe, paste the HTML code into the appropriate section of your theme or content area. Make sure to place the code within the
iframeorembedtags as provided by the third-party service. -
How do I troubleshoot issues with custom HTML in Shopify?
If you encounter issues with custom HTML in Shopify, check for common errors like unclosed tags, incorrect syntax, or conflicts with existing CSS and JavaScript. Use browser developer tools to inspect the HTML and debug any issues. Additionally, reviewing Shopify’s documentation or seeking help from a developer can resolve more complex problems.
-
Can you upload an HTML file to Shopify?
Shopify does not let you upload a .html file and serve it as a page the way traditional hosting does. Instead, create a page under Online Store and Pages, open the <> Show HTML view, and paste the file’s HTML into it. For a full custom layout, paste the code into a Custom Liquid section in the theme editor, or add it to the theme files.
Conclusion: How To Add HTML Code In Shopify
Adding HTML to Shopify is not hard once you know which of the three routes fits the task. Put one-page code in the page editor, put reusable blocks in a Custom Liquid section, and save site-wide code for theme.liquid. The only real risk sits with theme-file edits, and duplicating the theme first takes that risk away.
If you would rather not open the code editor at all, a code injection app such as XO Insert Code lets you add, enable and disable snippets from one screen, which makes it easy to test a change before it goes live. Adding HTML is also only one part of the wider Shopify customization and design work you may want to do on your store.
Before you publish any snippet, paste it into a free code validator to catch unclosed tags and typos, since those are what break a theme. Remember too that some parts of Shopify, including core checkout on non-Plus plans, will not accept custom code, so check what a given area allows before you spend time on it.
