Webflow imposes a 10,000 character limit on custom code blocks inside the Embed element and Project Settings. If you need to exceed this limit, consider these workarounds.
1. Use External Hosting for Scripts
- Host large scripts externally on a service like GitHub Pages, Netlify, or a CDN.
- In Webflow, link the script inside the Custom Code section of Project Settings:
- Example:
<script src="https://yourdomain.com/script.js"></script>
2. Minify Your Code
- Minify JavaScript and CSS to reduce character count.
- Use tools like UglifyJS, Terser, or CSSNano.
- Example:
var x = function(){console.log("test")}
→ var x=()=>console.log("test")
3. Store Data in JSON Files
- If your custom code has large datasets, save the data in a separate JSON file and fetch it dynamically via JavaScript.
- Example:
- Save
{ "items": ["item1", "item2"] }
in data.json
. - Use
<script>
to fetch this file in Webflow.
4. Use Webflow CMS for Dynamic Content
- If the code includes content that changes, consider storing it in Webflow CMS and injecting it via JavaScript.
- Example: Use a CMS Collection List and target items via
document.querySelectorAll()
.
5. Move Script to the Browser Console
- If this is for development/testing, paste the code into the browser console instead of embedding it in Webflow.
- Press
F12
or Cmd + Option + J
(Mac) to open DevTools and run JavaScript.
Summary
Since Webflow enforces a 10,000 character limit, you can bypass this by hosting scripts externally, minifying your code, loading JSON dynamically, leveraging CMS, or using the console for testing.