Can you convert html, css and javascript into a exe?

  • Electron, by GitHub. Lets you build cross-platform Windows, MacOS, and Ubuntu applications from HTML/JavaScript/CSS. It works by embedding them into a Chromium build alongside with Node.js. Many applications such as Slack and Visual Studio code are built with Electron.
  • Cordova, by the Apache Foundation. Targets Android, iOS, and Windows from HTML/JavaScript/CSS. It works by embedding them into a WebView (or whatever is the equivalent on the target platform).
  • Proton Native. Works with React Native components and does not use Electron (see above), which makes generated apps therefore more “lightweight” than the ones generated by Electron. Uses libui under the hood.
  • Yes, there is a program HTML Compiler that allows you to convert an entire HTML application (using CSS, JavaScript, Images and more) into a standalone Windows application.
  • There is also ExeOutput for PHP that lets you create applications in native format for Windows with PHP, JavaScript and HTML. Convert PHP scripts, websites, JavaScript, HTML, databases into stand-alone apps for Windows (single EXE files) that do not require a Web server nor PHP distribution.

For window apps

If you need something to present you a window environment and a webserver emulation, choose ZZEE or ExeOutput, these are decent tools, maybe ZZEE is a bit outdated regarding the PHP version. So for “HTML, CSS and Javascript”, the answer is clearly something like this.

For console apps

If you only need a tool to run in the background or from command line, here’s my pet project called RapidEXE – it’s quite simple to use, somewhat extendable and features PHP 7 out of the box. Also, it’s free and always will be. But since there’s no browser involved, technically this is not solution for HTML/CSS/JS; just something very similar, like using web-related languages to create EXE files.

A real compiler: JSC

If you want (something-like-)javascript to be compiled to a standalone EXE, give a chance to JSC, it’s there in your Windows, you just probably never met before. JSC gives you extremely small executables (because of the .NET already built into Windows itself) and they have full power of .NET so you can do pretty much anything you want. Flipside: apart from the syntax being familiar, not a lot will remind you of Javascript, you have to learn a lot of new practices to get along.

A bonus track: “chrome –app” and RAR

If you can live with a dependency such as Chrome, you can do a nasty but working solution: RAR can create a self-extracting EXE for you and run a command after extraction (!!), so you can pack up a little micro-universe of HTML/CSS/JS files; then you can call Chrome with “–app=something.html” that will give you a plain window with a browser environment and your HTML file in it. I know this is not a compiler; however, it’s a way to create an EXE that is self-contained and gives the user a web-liek experience in an application-like window. Sure, Javascript will be a bit limited because you’re running in a local file, not a proper website, but it’s not that painful. One lovely thing about this technique is that Chrome will remember the position and size of your window so it will pretty much feel like an application.

Source and comments

This entry was posted in Dev. Bookmark the permalink.

Leave a Reply