img2css is a free, open source design & prototyping project written in JavaScript and released under BSD-3-Clause. It has 2,496 GitHub stars, 187 forks and 5 open issues, and was last pushed 26 days ago. On this registry it ranks #19 of 23 tracked projects in Design & Prototyping, with 5 head-to-head comparisons available.

What is img2css?

img2css is a browser-based design tool that converts any image into pure CSS, aimed at frontend developers, designers and pixel-art enthusiasts who want image output without shipping image files.

What it is

img2css is a JavaScript project, published under the BSD-3-Clause licence, that turns an uploaded image into CSS markup rather than a bitmap asset. It lives in the frontend and design-tooling ecosystem, the same space as CSS generators, prototyping utilities and asset-reduction helpers, and it carries the registry topics css, design, design-tool, frontend, img2css, javascript, pixel-art and react. The public build is served at https://javier.xyz/img2css, and the repository at javierbyte/img2css is the source for that site.

The concrete problem it solves is asset delivery. A conventional page loads an image through an img tag or a background-image rule, which means the browser must fetch a separate file from a host. img2css replaces that request: it resizes the source image and emits it either as a matrix of box-shadow values or as a base64 payload. In the pure CSS mode, each pixel becomes a box-shadow on a single pixel div, so no img tag and no background-image are needed at all. The author is explicit that this output can be enormous and that production use is not recommended unless there is no other option. The base64 mode writes the whole image file inside the img tag as a data URI, which removes the need for external hosting without removing the image.

Key capabilities

  • Two distinct outputs: a pure CSS box-shadow matrix, and a base64 image embedded directly in the img tag.
  • Pure CSS mode renders every pixel as a box-shadow on one single-pixel div, requiring no img tag and no background-image.
  • Base64 mode embeds the entire image file in the markup, so no external hosting is required.
  • Hosted converter at https://javier.xyz/img2css, usable without any local setup.
  • Static site build: pnpm build writes the compiled site to out/.
  • Local development server through pnpm install followed by pnpm dev.
  • Automated deploy: a push to main publishes to the gh-pages branch, which serves javier.xyz/img2css.
  • Related work named in the README: canvas-image-utils for a programmatic route, and morphin for a per-pixel animation experiment.

Who uses it and how

  • Frontend developers stripping external image requests from small decorative graphics, favicons or icons where inlining beats a separate fetch.
  • Designers and prototypers producing single-file demos where the page must carry its own visual assets with no hosting step.
  • Pixel-art creators, matching the repository's pixel-art topic, because the per-pixel box-shadow model maps cleanly onto low-resolution sprites.
  • Teams that already run static sites on GitHub Pages, since the deploy path targets a gh-pages branch directly from main.
  • Developers who need the same conversion inside a build or script, who are pointed by the README toward canvas-image-utils instead of the web UI.

Getting started

The fastest route is the hosted tool at https://javier.xyz/img2css. To run it locally, install with pnpm install, start it with pnpm dev, and generate the static site with pnpm build, which outputs to out/.

How it compares

No list of paid products replaced by this project appears in the facts, and no competing tools are named either. The README references only the author's own adjacent projects, canvas-image-utils for programmatic conversion and morphin for animation. In this registry it stands alone for its specific job of converting an image into pure CSS.

When to use it — and when not to

Use it for small, decorative or pixel-art assets, for offline single-file demos, or when the goal is to remove an external image request entirely. Do not use the pure CSS output for anything large or production-facing: the README states that the output can be huge and that this mode is not recommended for production unless no alternative exists. The README is also sparse on internals, so anyone evaluating the tool should expect to judge it from the two output modes and the hosted site rather than from documentation.

project readme (upstream, from github) — read inline

img2css

Convert any image to pure CSS.

img2css

How does it work?

It has two different outputs, pure css shadow matrix [1] and base64 embedded image [2].

  • Pure CSS: This output was created by resizing and setting each pixel as a box-shadow of a single pixel div, so no img tag or background-image is needed. This can result in huge outputs, and the use of this output is not recommended for production unless there is no other option.
  • Base64: The entire image file is embedded inside the `` tag using base64, so no need external hosting is needed.

Development

pnpm install
pnpm dev

pnpm build writes the static site to out/. Pushing to main deploys it to the gh-pages branch, which javier.xyz/img2css serves.

Frequently asked questions

Is img2css free to use?

img2css is open source under the BSD-3-Clause licence. There is no licence fee and no seat count — you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does img2css do?

Convert any image to pure CSS. Recreates images using only box-shadows.

What is img2css written in?

img2css is primarily written in JavaScript. Its source is publicly available at https://github.com/javierbyte/img2css, and it has 2,496 GitHub stars.