HTML5 Game to Android APK: Fullscreen, Landscape, Saves
You built a game with HTML, CSS and JavaScript, and it runs well in a desktop browser. Now you want it on a phone as a proper app: its own icon, no browser bar, landscape screen, and it works on a train with no signal. That is what turning an HTML5 game into an APK does.
This guide walks through it with Free HTML to APK, which supports HTML, CSS, JavaScript, localStorage, canvas and WebGL. It covers the settings games need, how to keep scores, and the mistakes that cause a black screen.
Prepare your game files
Most HTML5 games are a folder with an index.html, some scripts, and images or sounds. Check these points before you build:
- The entry page is called
index.htmland sits at the top level of the folder. - Every asset is inside the folder. Nothing should point to a path on your computer such as
C:\Games\.... - Paths are relative, for example
assets/hero.png, not/assets/hero.pngand not a full web address. - Letter case matches exactly. Android file systems treat
Hero.pngandhero.pngas different files. A game that works on Windows can break on a phone for this reason alone.
If your game is one file with everything inside it, you can paste the HTML directly. For a folder, compress it to a ZIP so that index.html is at the top level of the ZIP, not inside an extra sub-folder.
Make the game fit a phone screen
Add the viewport tag to the <head>:
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
Then size your canvas to the window rather than to a fixed number of pixels. A simple approach is to set the canvas width and height from window.innerWidth and window.innerHeight, and update them on the resize event. If your game has a fixed design size, scale it to fit while keeping the aspect ratio, and fill the rest with a background colour.
Touch matters more than the keyboard. Add touchstart and touchend (or pointer events) next to your mouse and key handlers. On-screen buttons for left, right and jump are usually needed for platformers.
To stop the page from scrolling or selecting text while someone plays, set touch-action: none and user-select: none on the game container in CSS.
Build the APK
- Open Free HTML to APK.
- Choose the ZIP of your game, or pick your single
.htmlfile. - Enter the app name and pick an icon. A simple, high-contrast icon is easier to recognise on a crowded home screen.
- Turn on landscape if the game is wide, and fullscreen so the status bar does not cover the playfield.
- Tap Build and install the APK on your phone.
The game is packaged inside the APK, so it runs offline. There is no watermark.
Saving progress with localStorage
Scores, unlocked levels and settings can be stored in localStorage, which the app supports. A minimal pattern looks like this:
localStorage.setItem("best", String(score));const best = Number(localStorage.getItem("best") || 0);
Some practical habits:
- Save when something meaningful changes (level complete, new high score), not on every animation frame.
- Store one JSON object under one key, for example
JSON.stringify(saveData), and give it a version number so you can change its shape later. - Wrap reading in a try/catch, and fall back to a fresh save if the stored text is damaged.
- Remember that saved data belongs to the installed app. If someone uninstalls it, the save goes with it.
Sound on mobile
Phones usually block audio until the player has touched the screen. Start your music after the first tap, for example when the player presses a Play button. If you use the Web Audio API, call audioContext.resume() inside that tap handler. Without it, a game can look fine and stay silent.
Common problems and fixes
Black or blank screen on launch
Usually a file path error. Check that index.html is at the top of your ZIP, that script and image paths are relative, and that the letter case matches. Open the browser console on your computer, load the game from a plain folder, and fix any "404" or "not found" messages.
Works on Wi-Fi, fails offline
Your game loads a library or font from a CDN. Download the file, put it in the project folder, and point to it with a relative path. This includes game libraries, web fonts and sound files hosted elsewhere.
Images load but look blurry
Phone screens have a high pixel density. Scale the canvas drawing buffer by window.devicePixelRatio and keep its CSS size the same. Turn off image smoothing for pixel art.
Game runs slowly
Reduce the canvas resolution, reuse objects instead of creating new ones every frame, and avoid heavy work inside the draw loop. Test on a mid-range phone rather than only your fastest device.
Wrong orientation
Set landscape in the build options. If the game still looks rotated, check that your own code does not assume a taller-than-wide window.
Before you share it
Play for ten minutes in airplane mode. Close the app, reopen it, and check that scores and progress remain. If you plan to put the game on Google Play, you will also need the AAB file the app can produce and a privacy policy; see Google's current rules, because acceptance is always their decision.
Ready to try? Get Free HTML to APK on Google Play.
FAQ
Which kinds of games work?
Games made with HTML, CSS and JavaScript, including canvas and WebGL games. Engines that output a normal HTML folder can be zipped and built the same way.
Will the game work without internet?
Yes, as long as every asset is inside your project. The files are packaged in the APK.
Can I lock the game to landscape?
Yes. Landscape and fullscreen are options you choose before building.
Is the app free, with no watermark?
Yes. Free HTML to APK is free and does not add a watermark to your game.