Claude Code
AI Code Editors & Agents
Anthropic's agentic coding tool for the terminal, VS Code and JetBrains. Uses a Claude Pro/Max plan or the API.
#cli#agentHome › Responsive Canvas Scaling for HTML5 Games: Letterboxing, devicePixelRatio and Portal Sizes (2026)
A browser game runs in a box you don't control: a phone held either way, a portal iframe at a handful of fixed sizes, a 4K monitor at 150% zoom. Get scaling wrong and the game is blurry, stretched, cut off or slow. This guide explains the two sizes every canvas has, the four scaling strategies (and which engine setting matches each), how to handle devicePixelRatio without melting phones, and what Poki and CrazyGames check. There's a paste-ready plain-JS scaler, tested with simulated browser objects. Every fact comes from MDN, the W3C, the portals' developer docs or the engines' own docs.
Last updated:
Free download · one page + PDF · updated weekly, current edition November 16, 2026
The best AI tool for each job in a solo or indie game (3D, sprites and pixel art, animation, audio, NPCs), MCP setups for Unity, Unreal, Godot and Roblox, and which free plans you can actually ship with.
Yours free when you join the VibeStack Weekly: new AI game-dev tools and releases every Monday, 5-minute read. Unsubscribe anytime.
| Question | Short answer |
|---|---|
| Why is my canvas blurry? | Its backing store (the width/height attributes) is smaller than its displayed size in device pixels. Set it to CSS size × devicePixelRatio |
| Letterbox or fill? | Fit (letterbox) shows the whole design with bars; fill crops; expand shows more of the world. Most portal games want fit or expand at 16:9 |
| Pixel art looks uneven | Scale by whole numbers of device pixels and set image-rendering: pixelated (or turn off imageSmoothingEnabled on a 2D context) |
| Should I cap devicePixelRatio? | Usually, yes. Mobile screens often report above 2 (MDN), and the pixel count grows with the square of the ratio. We cap at 2 |
| resize event or ResizeObserver? | ResizeObserver: it watches the game's own element, so it catches size changes that have nothing to do with the window. resize only fires on window |
| Exact device pixels? | ResizeObserver with box: 'device-pixel-content-box': Chrome 84+, Firefox 108+, not Safari. Fall back to rounding |
| Poki's sizes | 16:9; the game must scale to cover the full canvas, proportionally to 640x360, 836x470 or 1031x580 |
| CrazyGames' sizes | Ten listed iframe sizes from 800×450 (mobile) to 1920×1080; text must be readable at devicePixelRatio 1 |
This page is about fitting the game to the screen. For zips, portals and SDKs see how to publish an HTML5 game; for dvh units, safe areas, fullscreen and orientation on phones see touch controls for HTML5 games; Godot users should also read Godot web export for itch.io and Poki.
width and height attributes: the pixels you actually draw. MDN gives the defaults as 300 × 150 when they aren't set. Unity's docs call the WebGL equivalent the render target size, the resolution the GPU renders to.width or height clears the canvas and resets the whole context (fill style, transforms, smoothing), even if you set it to its current value (MDN). Only set it when the size actually changes, and re-apply your context settings afterwards. Our code does both.drawingBufferWidth should match the canvas width but can differ if the implementation can't provide the requested size. MDN also says iOS devices limit a canvas to 4,096 × 4,096 pixels, and that a canvas over the limit is unusable.Pick a base (design) size, say 640×360 or 1280×720 for 16:9, then choose how it maps onto the box you're given:
| Strategy | What the player sees | Phaser 4 | Godot 4 (Stretch Aspect) | Use it for |
|---|---|---|---|---|
| Fit (letterbox / pillarbox) | The whole design, scaled to the shorter side, with bars on the other | Phaser.Scale.FIT | keep | Fixed-layout puzzle and arcade games; the safe default for portals |
| Fill (cover / crop) | No bars; the edges of the design are cut off | Phaser.Scale.ENVELOP | No direct equivalent in the docs we checked | Backgrounds and games whose edges don't matter |
| Expand | No bars; the design is scaled like fit and the extra space shows more of the world | Phaser.Scale.EXPAND (since 3.80) | expand (or keep_width / keep_height to grow one direction only) | Scrolling and open-world games, HUDs anchored to the edges |
| Integer | Whole-number scale for crisp pixel art, usually with bars | pixelArt: true; zoom for a fixed multiple | Stretch Scale Mode integer (since 4.2) | Pixel art |
| Stretch | Everything, distorted to the box | No stretch mode; RESIZE resizes the canvas to the parent regardless of aspect ratio | ignore | Almost never; Poki requires proportional scaling |
MDN's canvas optimization guide shows the core math: scaleToFit = Math.min(scaleX, scaleY) and scaleToCover = Math.max(scaleX, scaleY), where each scale is the available size divided by the game size. Godot's docs explain the trade-offs well: keep adds black bars, keep_height suits horizontally scrolling 2D games like runners and platformers, keep_width suits GUIs and HUDs that scale, and expand keeps neither base dimension.
image-renderingdevicePixelRatio of 1.25, a 2× CSS scale is 2.5 device pixels per game pixel. Our code picks the largest whole number of device pixels that fits and snaps the offsets to whole device pixels too.image-rendering: pixelated. MDN: it scales with nearest neighbor (or similar) to the nearest integer multiple of the original size, then smooths to the final size, so pixel art keeps its look without artifacts even when the final scale isn't an integer. Compat data: Chrome 41, Firefox 93, Safari 10. crisp-edges uses a nearest-neighbor-style algorithm that keeps edges and contrast (unprefixed only since Chrome 148, Firefox 65 and Safari 7).imageSmoothingEnabled = false keeps scaled images sharp (MDN; on by default). Resizing the canvas resets it, so set it again after every resize.| Frame (who lists it) | Fit scale for a 640×360 base | Integer: 640×360 base | Integer: 320×180 base |
|---|---|---|---|
| 640×360 (Poki) | 1.000 | 1× → 640×360, no bars | 2× → 640×360, no bars |
| 836×470 (Poki) | 1.306 | 1× → 640×360 | 2× → 640×360 |
| 1031×580 (Poki) | 1.611 | 1× → 640×360 | 3× → 960×540 |
| 800×450 (CrazyGames mobile) | 1.250 | 1× → 640×360 | 2× → 640×360 |
| 907×510 (CrazyGames desktop) | 1.417 | 1× → 640×360 | 2× → 640×360 |
| 1080×607 (CrazyGames tablet) | 1.686 | 1× → 640×360 | 3× → 960×540 |
| 1216×684 (CrazyGames desktop) | 1.900 | 1× → 640×360 | 3× → 960×540 |
| 1920×1080 (CrazyGames fullscreen) | 3.000 | 3× → 1920×1080, no bars | 6× → 1920×1080, no bars |
Poki says the game must scale to cover the full canvas, so a 640×360 game shown at 1× in an 836×470 frame would likely fail that check. For portals, either use fit with image-rendering: pixelated (MDN's definition above is designed for non-integer scales) or a smaller base with integer scaling plus expand to fill the leftover space with more world. That's our recommendation, not a portal rule; check it in the Poki Inspector's Scaling Tests.
devicePixelRatio and scales the context by the same amount, so you keep drawing in CSS units.matchMedia('(resolution: …dppx)') query that you re-create on every change; our code uses it.devicePixelRatio²). CrazyGames already runs Unity games at a ratio of 1 on iOS and low-memory Android because higher ratios crashed them. Our MAX_DPR = 2 is a starting point, not a rule; lower it if phones struggle.canvas.width = width * devicePixelRatio causes moiré artifacts with non-integer ratios (common with Windows UI scaling and zoom). That's what device-pixel-content-box below solves.devicePixelRatio of 1 on its listed iframe sizes, so test at 100% zoom on a non-HiDPI screen (or set the ratio to 1 in your browser's device emulation).resize fires on window only (MDN). It tells you the window changed, not that your game's box did, and MDN points to ResizeObserver for elements.ResizeObserver reports changes to an element's content or border box (MDN). Per the W3C draft, it fires when observation starts (if the element is rendered and not 0×0), when the element is inserted or removed or set to display: none, but not for CSS transforms. Callbacks run after layout and before paint. Support: Chrome 64, Firefox 69, Safari 13.1.contentBoxSize is an array of { inlineSize, blockSize } since Chrome 84, Firefox 92 and Safari 15.4 (older Firefox returned a single object), so keep a contentRect fallback, as MDN's example does.device-pixel-content-box gives the content box in device pixels, before CSS transforms, and the spec says the values are integers. The W3C draft explains why you can't compute it yourself: CSS size × devicePixelRatio is only an approximation, because browsers snap subpixels in their own ways. Compat data: Chrome 84, Firefox 108 (93–107 returned wrong values), not Safari. MDN's WebGL best practices recommend it where supported.resizeInterval: how many milliseconds between checks of the browser size (default 500).Size the game's box with 100dvh (with a 100vh fallback) so it follows the mobile browser bars, and keep HUD buttons inside env(safe-area-inset-*). We cover both, with compat versions, in the mobile-ready HTML shell of our touch guide. With fill or expand, the game reaches the screen edges, so anchor HUD elements to the visible area plus the safe-area insets. CrazyGames' app docs say it this way: keep gameplay fullscreen, but move important UI into the safe area.
Plain JavaScript, no dependencies. It supports all four strategies, caps devicePixelRatio, uses ResizeObserver with exact device pixels where the browser supports them (falling back to rounding, then to the resize event), follows ratio changes, and converts pointer positions to game coordinates. First the HTML and CSS it expects:
<!-- in <head> (see the touch controls guide for the full mobile shell) -->
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<style>
html, body { margin: 0; height: 100%; overflow: hidden; background: #000; }
#game { /* the box the game scales into */
position: fixed; left: 0; top: 0; width: 100%;
height: 100vh; /* older browsers */
height: 100dvh; /* follows the mobile browser bars */
overflow: hidden; /* "fill" mode crops here */
touch-action: none;
}
#game canvas { display: block; } /* createScaler() sets position, size, image-rendering */
</style>
<!-- in <body> -->
<div id="game"><canvas></canvas></div>// Responsive canvas scaling for a web game (plain JS, no dependencies).
// Modes: "fit" = letterbox/pillarbox, "fill" = cover and crop, "expand" = show more world,
// "integer" = whole-number scaling for pixel art (renders at the base size, CSS upscales).
const BASE_W = 640, BASE_H = 360; // your design size (16:9)
const MAX_DPR = 2; // cap on devicePixelRatio for the backing store
// Pure math, CSS pixels in and out: where the canvas goes inside a cssW x cssH box.
function computeLayout(cssW, cssH, mode, dpr, baseW = BASE_W, baseH = BASE_H, maxDpr = MAX_DPR) {
const sx = cssW / baseW, sy = cssH / baseH;
let scale, viewW = baseW, viewH = baseH;
if (mode === "fill") scale = Math.max(sx, sy);
else if (mode === "integer") {
const k = Math.floor(Math.min(sx, sy) * dpr + 1e-9); // whole device pixels per game pixel
scale = k >= 1 ? k / dpr : Math.min(sx, sy); // smaller than the base size: plain fit
} else scale = Math.min(sx, sy); // "fit" and "expand"
if (mode === "expand") { viewW = cssW / scale; viewH = cssH / scale; }
const width = viewW * scale, height = viewH * scale;
let left = (cssW - width) / 2, top = (cssH - height) / 2;
const pixelated = mode === "integer";
if (pixelated) { left = Math.round(left * dpr) / dpr; top = Math.round(top * dpr) / dpr; }
const r = Math.min(dpr, maxDpr);
const backingW = pixelated ? baseW : Math.max(1, Math.round(width * r));
const backingH = pixelated ? baseH : Math.max(1, Math.round(height * r));
return { scale, viewW, viewH, width, height, left, top, backingW, backingH, pixelated };
}
// Keeps `canvas` scaled inside `container` (give the container a size and position: relative or fixed).
// onResize(layout, k) runs after every change; k = backing pixels per game unit, for ctx.setTransform.
function createScaler(canvas, container, mode = "fit", onResize = () => {}) {
let dpr = window.devicePixelRatio || 1, cssW = 0, cssH = 0, devW = 0, devH = 0, layout = null;
let dprQuery = null;
canvas.style.position = "absolute";
canvas.style.imageRendering = mode === "integer" ? "pixelated" : "auto";
function apply() {
if (!cssW || !cssH) return; // hidden or not laid out yet
layout = computeLayout(cssW, cssH, mode, dpr);
const s = canvas.style;
s.left = layout.left + "px"; s.top = layout.top + "px";
s.width = layout.width + "px"; s.height = layout.height + "px";
let w = layout.backingW, h = layout.backingH;
// Exact device pixels from ResizeObserver, if they match this layout (a stale entry won't).
if (!layout.pixelated && dpr <= MAX_DPR && Math.abs(devW - layout.width * dpr) <= 1
&& Math.abs(devH - layout.height * dpr) <= 1) { w = devW; h = devH; }
// Setting width/height clears the canvas and resets context state, so only touch them on change.
if (canvas.width !== w || canvas.height !== h) { canvas.width = w; canvas.height = h; }
onResize(layout, canvas.width / layout.viewW);
}
function watchDpr() { // zoom or a move to another monitor
if (dprQuery) dprQuery.removeEventListener("change", onDpr);
dprQuery = window.matchMedia(`(resolution: ${dpr}dppx)`);
dprQuery.addEventListener("change", onDpr);
}
function onDpr() { dpr = window.devicePixelRatio || 1; devW = devH = 0; watchDpr(); apply(); }
watchDpr();
let ro = null, onWinResize = null;
if (typeof ResizeObserver === "function") {
ro = new ResizeObserver((entries) => {
for (const e of entries) {
if (e.target === container) {
const b = e.contentBoxSize && e.contentBoxSize[0];
cssW = b ? b.inlineSize : e.contentRect.width;
cssH = b ? b.blockSize : e.contentRect.height;
} else if (e.target === canvas && e.devicePixelContentBoxSize) {
devW = e.devicePixelContentBoxSize[0].inlineSize;
devH = e.devicePixelContentBoxSize[0].blockSize;
}
}
apply();
});
ro.observe(container);
try { ro.observe(canvas, { box: "device-pixel-content-box" }); } catch (err) { /* not supported */ }
} else {
onWinResize = () => { cssW = container.clientWidth; cssH = container.clientHeight; apply(); };
window.addEventListener("resize", onWinResize);
onWinResize();
}
return {
get layout() { return layout; },
// Pointer position (clientX/Y, CSS px) -> game units; null when outside the game area.
toGame(clientX, clientY) {
if (!layout) return null;
const r = canvas.getBoundingClientRect();
const x = (clientX - r.left) / r.width * layout.viewW, y = (clientY - r.top) / r.height * layout.viewH;
return x < 0 || y < 0 || x > layout.viewW || y > layout.viewH ? null : { x, y };
},
destroy() {
if (ro) ro.disconnect();
if (onWinResize) window.removeEventListener("resize", onWinResize);
if (dprQuery) dprQuery.removeEventListener("change", onDpr);
},
};
}
// Example (2D canvas):
// const canvas = document.querySelector("#game canvas"), ctx = canvas.getContext("2d");
// const scaler = createScaler(canvas, document.getElementById("game"), "fit", (layout, k) => {
// ctx.setTransform(k, 0, 0, k, 0, 0); // draw in game units (0..viewW, 0..viewH)
// ctx.imageSmoothingEnabled = !layout.pixelated; // resizing resets this, so set it here
// });
// In "expand" mode the 640x360 base area sits at ((viewW - 640) / 2, (viewH - 360) / 2).
// canvas.addEventListener("pointerdown", (e) => { const p = scaler.toGame(e.clientX, e.clientY); });
Download canvas-scaler.js (the same code as a file, MIT license). It pairs with touch-controls.js and gamepad.js from our touch controls and Gamepad API guides. All files: free downloads.
ResizeObserver, matchMedia and canvas objects: letterbox and pillarbox offsets, fill's negative offsets, expand's larger view, integer scale at ratios 1, 1.25, 1.5, 2, 2.625 and 3 (every result a whole number of device pixels, never larger than the box), offsets snapped to device pixels, the ratio cap, zero-size boxes, a stale device-pixel entry, no canvas reset when the size is unchanged, a ratio change, the old contentRect shape, a browser that rejects device-pixel-content-box, and the resize fallback. We haven't tested it on real phones, tablets or monitors; do that before you ship.k, backing pixels per game unit; ctx.setTransform(k, 0, 0, k, 0, 0) lets you draw in game units. In integer mode the backing store stays at the base size and CSS does the upscaling, so k is 1.toGame(clientX, clientY) turns pointer coordinates (CSS pixels) into game units, so it pairs with our touch controls code and mouse events.gl.viewport(0, 0, canvas.width, canvas.height) in the callback instead of setTransform, and check drawingBufferWidth if you push sizes near the limits.Prompt for your agent (Claude Code, Cursor or OpenAI Codex): “Make this game's canvas responsive: a 640×360 base size, fit (letterbox) by default with an option for expand, the canvas backing store set to its CSS size times devicePixelRatio capped at 2, ResizeObserver on the game container (use device-pixel-content-box on the canvas where supported), a matchMedia listener for devicePixelRatio changes, and only resize the canvas when its size changes. Re-apply context settings after each resize. Convert pointer coordinates to game units. Add a debug overlay showing the CSS size, backing size, ratio and scale.”
| Rule | Poki | CrazyGames |
|---|---|---|
| Aspect ratio | 16:9; must scale to cover the full canvas | Readable on responsive 16:9 iframe sizes; playable in landscape on desktop |
| Sizes they name | Scale proportionally to 640x360, 836x470 or 1031x580 | Desktop: 907×510, 1216×684, 1077×606, 821×462; desktop fullscreen: 1366×768, 1920×1080, 1536×864, 1280×720; mobile 800×450; tablet 1080×607 |
| Portrait games | On mobile, cover the full screen in portrait, landscape or both | Allowed; on desktop show black bars or background images at the sides |
| Resolution | Responsive design: a consistent experience across screen sizes and input methods | Legible at devicePixelRatio 1; consistent resolution throughout the game (quality guidelines) |
| Pixel ratio | Not covered on the pages we checked | Unity games: ratio 1 on iOS and low-memory Android, the device's own ratio elsewhere |
| How to test | Poki Inspector: Scaling Tests at the bottom of the screen, for different dimensions and popular devices | Load the game in an iframe at the listed sizes |
All of the frames both portals list are within a pixel of 16:9 (our math: a 640×360 base in fit mode leaves at most 0.9 px of bars), so a 16:9 base with fit or expand is the easy path. CrazyGames provides fullscreen itself and prohibits custom fullscreen buttons; see the fullscreen section of our touch guide.
scale: { mode: Phaser.Scale.FIT, autoCenter: Phaser.Scale.CENTER_BOTH, width: 640, height: 360 }. The modes are NONE (the default), FIT, ENVELOP, EXPAND, RESIZE, WIDTH_CONTROLS_HEIGHT and HEIGHT_CONTROLS_WIDTH; autoCenter defaults to NO_CENTER. In NONE, if you resize the canvas yourself you must call the Scale Manager's resize(), or input stops working. For pixel art, pixelArt: true turns off antialiasing and turns on roundPixels; smoothPixelArt (WebGL only) keeps blocky pixels with smoothed edges. zoom multiplies the canvas size; Phaser.Scale.MAX_ZOOM derives it from the largest multiplied game size that fits the parent. autoRound rounds the display size, which the docs say can help on low-powered devices. Listen for this.scale.on('resize', …) to re-layout your HUD.display/window/size/viewport_width and viewport_height (default 1152×648). Then display/window/stretch/mode (disabled by default, canvas_items, viewport), stretch/aspect (ignore, keep by default, keep_width, keep_height, expand), stretch/scale and stretch/scale_mode (fractional by default, or integer; the class reference notes that integer scaling clips the game if the window gets smaller than the base size). Godot's recommendations: for pixel art, a base like 640×360 with viewport, keep (or expand) and integer; for a landscape mobile game, 1280×720 with canvas_items and expand. For the web export, Canvas Resize Policy is None (you size it from your HTML shell), Project (follows the project settings) or Adaptive (fills as much of the page as possible); the docs say the canvas matches the browser window by default. DisplayServer.screen_get_scale() is implemented on the web.devicePixelRatio: 1 (or another value) to the Unity instance config in your WebGL template's index.html. To size the render target yourself, set matchWebGLToCanvasSize: false, and set the CSS size on #unity-canvas in the template.toGame() (or your engine's input) should hit the right spot.devicePixelRatio, capped; only reset when it changes; context settings re-appliedResizeObserver on the game box (with a contentRect fallback); device-pixel-content-box where supportedimage-rendering: pixelated; imageSmoothingEnabled = falsedvh sizing and safe-area padding for HUD (see the touch guide)Related: publish an HTML5 game (itch.io, Poki, CrazyGames, Playgama) · touch controls for HTML5 games · Godot web export · controller support (Gamepad API) · AI pixel art generators · how to vibe code a game
Shipping a browser game to portals? Get the VibeStack Weekly digest: new AI game-dev tools and web and Steam publishing changes, every Monday.
Sources (checked October 29, 2026): MDN Web Docs (Window.devicePixelRatio; ResizeObserver, ResizeObserver.observe(), ResizeObserverEntry.contentBoxSize and devicePixelContentBoxSize; Window resize event; <canvas> (sizing and maximum canvas size); HTMLCanvasElement.width; Optimizing canvas; CanvasRenderingContext2D.imageSmoothingEnabled; image-rendering; WebGL best practices; WebGLRenderingContext.drawingBufferWidth) and MDN's browser-compat-data for version numbers; the W3C Resize Observer Working Draft (11 February 2020) and the CSS Working Group editor's draft (22 November 2022); Poki developer docs (Requirements, Poki Inspector, web engines); CrazyGames developer docs (Gameplay requirements, Technical requirements, CrazyGames App, FAQ); Phaser 4.1.0 docs (ScaleModes, Zoom, ScaleManager, Types.Core GameConfig and ScaleConfig, Scale Manager concepts page); Godot 4.7 docs (Multiple resolutions; Exporting for the Web; EditorExportPlatformWeb and ProjectSettings class reference); Unity 6.3 Manual (Configure a Web Canvas size). The code, the integer-scale table, the recommendations and the checklist are ours, not the browser makers', portals' or engines'. We tested the scaling math and the resize handling in Node with mocked browser objects, not on real phones, tablets or monitors, so check it on real devices before you ship.
AI Code Editors & Agents
Anthropic's agentic coding tool for the terminal, VS Code and JetBrains. Uses a Claude Pro/Max plan or the API.
#cli#agentAI Code Editors & Agents
AI-first code editor with agent mode, built on VS Code.
#editor#agentAI Code Editors & Agents
OpenAI's coding agent: CLI, IDE extension, web and cloud tasks. Included in ChatGPT plans (Free with limits). Unity ships an official Codex skills plugin (unity@unity-agent-plugin) for Unity 6+. The ModRetro Chromatic plugin (November 2026) builds Game Boy and Game Boy Color games as GB Studio projects, playtests them in a built-in emulator and can flash them to a Chromatic handheld cartridge.
#cli#agentAI Code Editors & Agents
AI pair programmer and coding agent across VS Code, JetBrains and the CLI. Free plan available; Gemini 4 Argon on Pro+ and higher.
#editor#agent#githubReach builders, vibe coders & indie game devs. Featured listings from $49/mo.
Advertise →Pick a base size (for example 640×360 for 16:9), measure the box the game lives in, and scale by Math.min(boxWidth / baseWidth, boxHeight / baseHeight) to fit it with bars, or Math.max to fill and crop. Center the canvas, set its backing store to the displayed size times devicePixelRatio, and re-run all of that from a ResizeObserver on the box.
The canvas's width and height attributes (the backing store) are smaller than its displayed size in device pixels, so the browser stretches it. Set canvas.width and canvas.height to the CSS size times window.devicePixelRatio and scale the context by the same amount, as MDN's example does. Cap the ratio (we use 2) to keep phones fast.
Usually. Mobile screens often report more than 2, and the number of pixels to fill grows with the square of the ratio: 3 means 9 times the pixels of 1. CrazyGames already runs Unity games at a ratio of 1 on iOS and low-memory Android because higher ratios crashed. A cap of 2 is our starting point; lower it if a device struggles.
Scale by a whole number of device pixels per game pixel and set image-rendering: pixelated on the canvas, or turn off imageSmoothingEnabled on a 2D context. MDN says pixelated scales by nearest neighbor to the nearest integer multiple, then smooths to the final size, so it also works at non-integer scales. In Godot 4.2+, set Stretch Scale Mode to integer; in Phaser, set pixelArt: true.
ResizeObserver. The resize event only fires on window, while ResizeObserver tells you when the game's own element changes size, even when the change has nothing to do with the window size. It's supported since Chrome 64, Firefox 69 and Safari 13.1. With box: 'device-pixel-content-box' it reports exact device pixels in Chrome 84+ and Firefox 108+, but not in Safari.
Poki requires a 16:9 aspect ratio: the game must scale to cover the full canvas, proportionally to 640x360, 836x470 or 1031x580. It must also support desktop, mobile and tablet, covering the full screen in portrait, landscape or both on mobile. The Poki Inspector's Scaling Tests let you try different dimensions and devices.
CrazyGames lists 907×510, 1216×684, 1077×606 and 821×462 for desktop, 1366×768, 1920×1080, 1536×864 and 1280×720 for desktop fullscreen, 800×450 for mobile and 1080×607 for tablet. Text and images must be legible at those 16:9 sizes at a devicePixelRatio of 1, and games must be playable in landscape on desktop.
In Phaser 4's docs, FIT fits the game inside the parent while keeping the aspect ratio, which can leave uncovered space; ENVELOP covers the whole area while keeping the aspect ratio, so it can extend past it; EXPAND resizes the visible area to all the parent space like RESIZE and scales the canvas to fit inside it like FIT. The default mode is NONE.
Godot's multiple-resolutions docs recommend, for pixel art, a base like 640×360 with stretch mode viewport, aspect keep (or expand) and scale mode integer; for a landscape mobile game, 1280×720 with canvas_items and expand. For the web export, Canvas Resize Policy controls whether the canvas follows the browser window (Adaptive), the project settings (Project) or your own HTML shell (None).
Free download · one page + PDF · updated weekly, current edition November 16, 2026
The best AI tool for each job in a solo or indie game (3D, sprites and pixel art, animation, audio, NPCs), MCP setups for Unity, Unreal, Godot and Roblox, and which free plans you can actually ship with.
Yours free when you join the VibeStack Weekly: new AI game-dev tools and releases every Monday, 5-minute read. Unsubscribe anytime.