Skip to content
Free tool · runs in your browser

Combine HTML, CSS and JS into one file

CodePen, a tutorial or your editor gave you three files. Paste them here and get one self-contained index.html that works anywhere — no missing stylesheet, no 404 script.

Why one file is easier to share

A page split into index.html, style.css and script.js only works while all three travel together and keep their relative positions. Email one of them, upload just the HTML, or open it from a chat app's download folder, and the page loses its styling or behaviour. A single-file HTML page has the CSS inside a <style> tag and the JavaScript inside a <script> tag, so there is nothing to lose: it opens the same from a USB stick, an email attachment or a link.

How the combiner handles a full page

If the HTML you paste is a complete document, the combiner removes the <link rel="stylesheet"> and <script src> tags that point at local files (because their contents are now inline), keeps anything loaded from a CDN, puts your CSS at the end of <head> and your script at the end of <body> — the position where the DOM already exists when it runs. If you paste only body markup, it wraps it in a proper document with the charset and viewport tags.

Images and fonts

Text assets inline easily; binary ones need encoding. Convert small images and icons with image to Base64 and paste the data URI into your src. For a site with many large images, skip inlining and upload the folder as a ZIP instead — HTMLtoLink serves every file at its original path.

Related guides

Frequently asked questions

Can I combine several CSS or JS files?

Yes. Use the Load buttons and select several files at once; they are joined in the order you pick them. Order matters for JavaScript — libraries first, your code last.

Does it work with ES modules and import statements?

Choose ES module to emit type="module". Imports from full URLs (a CDN) keep working; imports of other local files will not, because those files are not part of the single page.

Why does my script say an element is null?

It probably ran before the HTML existed. The combiner puts scripts at the end of the body to avoid this; if you moved it to the head, add defer or wrap the code in a DOMContentLoaded listener.

More free tools

Your HTML deserves a real link

Paste code, drop a file, a ZIP or a whole folder — get a live URL with your own address, an optional password and a QR code. Free to start with Google sign-in; paid plans keep links online for good.

Turn HTML into a link