发布于 2026-09-05 · CATAITO

PNG 转 ICO 完全指南:免费在线转换(支持多尺寸)

手上有 PNG 的 Logo,想做成 Windows 能用的 .ico 图标?本文讲清 ICO 是什么、什么时候需要转、在线工具 / 桌面软件 / 命令行三种转换方法,以及尺寸上限、透明保留等注意事项——推荐方案免费且纯浏览器本地处理。

什么是 ICO 文件

ICO 是 Windows 的图标容器格式。和 PNG「一个文件一张图」不同,一个 ICO 文件里可以同时打包多个尺寸(16 / 32 / 48 / 64 / 128 / 256px 等),系统和浏览器按显示场景自动挑选最合适的一档:标签页用 16px,任务栏用 32px,桌面用 48px 或更大。关于 ICO 的历史与内部结构,见ICO 文件完全指南

PNG 则是通用图片格式:无损、支持透明,但一个文件只有一张图,也不含「多尺寸目录」这一层概念。所以「用 PNG 做图标素材、用 ICO 做图标交付」是最常见的工作流——这就需要一个转换步骤。

什么时候需要把 PNG 转成 ICO

  • 网站 favicon:浏览器默认请求网站根目录的 /favicon.ico,一个含 16/32/48px 的 ICO 是兼容性最稳的方案;
  • Windows 桌面/应用图标:快捷方式、文件夹、自研软件的图标都要求 .ico;
  • 开源项目发布:多数桌面软件的 Windows 发行包(含便携版)默认带 .ico。

反过来,macOS 用 icns、网页高清场景用 PNG/SVG 声明——不需要 ICO。各平台尺寸速查见App 图标尺寸指南

三种转换方法

方法一:在线转换(推荐,免费且本地处理)

用本站 图标工坊 IconForge,全程在浏览器本地完成,图片不上传服务器,一次打包多尺寸:

  1. 上传 PNG:点击或拖入 Logo 图片,建议用 256×256 以上的正方形透明 PNG。
  2. 选尺寸:在「尺寸」分组勾选需要的档位(做 favicon 勾 16/32/48,做应用图标建议全选到 256)。
  3. 导出:格式勾选 ICO,点击「生成图标资源包」,下载包含多尺寸 ICO 的压缩包。
  4. 部署:把 .ico 放到网站根目录,或在 HTML 里用 <link rel="icon"> 声明(写法见 Favicon 完全指南)。

方法二:桌面软件

GIMP(免费)可以「文件 → 导出为 → logo.ico」,导出时勾选压缩多尺寸;XnView / IrfanView 等看图工具也带 ICO 导出。适合离线环境或需要批量处理的场景,缺点是要装软件、多尺寸勾选位置各不相同。

方法三:命令行(ImageMagick)

装了 ImageMagick 的话,一条命令从 PNG 生成含多尺寸的 ICO:

magick logo.png -define icon:auto-resize=256,128,64,48,32,16 logo.ico

icon:auto-resize 会自动从大到小逐档缩放打包。适合写进构建脚本做自动化;只想偶尔转一个文件的话,在线工具更快。

转换注意事项

  • 256px 是上限:ICO 规范单张最大 256×256。源图更大的(比如 1024px)会先缩到 256 再打包,画质不受影响,但别指望 ICO 里塞进 512px——那是 PWA/macOS 图标的领域;
  • 源图用正方形:非正方形会被强制加白边或拉伸变形,转换前先在画布里居中裁成 1:1;
  • 透明会保留:ICO 支持 alpha 通道,带透明的 PNG 转出来依然是透明底,不会变白块;
  • 多尺寸别偷懒:只打包一张 256px 的 ICO 在标签页上会糊(浏览器自己缩到 16px 效果很差),务必包含 16/32 小尺寸档;
  • 16px 是玄学:极小尺寸下复杂 Logo 必然糊,专业做法是为 16px 单独画一个简化版——本站图标工坊支持 Light/Dark 双主题分别出图,配合的就是这类场景。

PNG vs ICO

维度PNGICO
文件内容一张图一个容器,打包多张不同尺寸
尺寸上限无实际限制单张最大 256×256
透明支持支持(alpha)支持(alpha)
系统自动选档做不到按场景挑 16/32/48/256
最适合素材、网页高清图Windows favicon、桌面/应用图标

一句话:PNG 是素材,ICO 是交付物。设计稿存 PNG,发布给 Windows 和 favicon 用 ICO。

常见问题

Q:ICO 和 PNG 有什么区别?

A:PNG 是普通图片格式,一个文件只有一张图;ICO 是 Windows 的图标容器格式,一个文件里可以打包多个尺寸(16/32/48/256px 等),系统按场景自动选用最合适的一档。做网站 favicon 或 Windows 应用图标时需要 ICO。

Q:可以直接把 .png 改名成 .ico 吗?

A:不可以。ICO 是有独立文件头和多图结构的容器格式,仅改扩展名不会改变文件的实际结构,多数场景会显示异常或无法识别。必须用工具真正转换一次。

Q:ICO 文件最大支持多少尺寸?

A:ICO 规范的单张最大尺寸是 256×256 像素。转换工具应把 256px 及以下各档写入容器;源图超过 256px 时会先缩到 256 再打包。更大的需求属于应用图标领域(macOS icns、PWA 512px),应使用对应格式。

Q:网站 favicon.ico 应该包含哪些尺寸?

A:传统建议包含 16、32、48 三档:16px 用于浏览器标签页,32px 用于任务栏/桌面小图标,48px 用于桌面视图。现代浏览器也可以配合 PNG/SVG 声明使用,但一个含 16/32/48 的 ICO 仍是兼容性最稳的底座。

Q:PNG 转 ICO 会丢失透明背景吗?

A:不会。ICO 完整支持 alpha 透明通道,只要源 PNG 带透明、转换时保留即可。本站转换全程在浏览器本地完成,透明通道原样写入。

Q:如何验证 ICO 文件里包含哪些尺寸?

A:最简单是用浏览器直接打开该 ICO(显示最大一档);想看完整尺寸列表可以用 Windows 的 Resource Hacker,或用本站图标工具重新载入检查。生成后建议重点抽查 16px 档是否清晰。

免费在线把 PNG 转成多尺寸 ICO

Light/Dark 双主题 · 透明保留 · 一次打包全部尺寸 · 纯浏览器本地处理

打开图标工坊 →

What Is an ICO File

ICO is Windows' icon container format. Unlike PNG — one file, one image — a single ICO can pack multiple sizes (16 / 32 / 48 / 64 / 128 / 256px) into one file, and the system picks the best fit per context: 16px for browser tabs, 32px for the taskbar, 48px+ for desktop. For the format's history and internals, see the complete ICO file guide.

PNG is the general-purpose format: lossless, transparent, but always a single image with no "size directory". So the common workflow is "PNG as source material, ICO as deliverable" — which needs a conversion step.

When You Need PNG → ICO

  • Website favicon: browsers request /favicon.ico from the site root by default; an ICO containing 16/32/48px is the most compatible option;
  • Windows desktop/app icons: shortcuts, folders, and your own software all expect .ico;
  • Open-source releases: most Windows distributions (including portable) ship with an .ico.

Conversely, macOS uses icns and high-DPI web contexts prefer PNG/SVG declarations — no ICO needed. See the app icon sizes guide for a cross-platform cheat sheet.

Three Ways to Convert

Option 1: Online Converter (Recommended — Free & Local)

Use this site's Icon Forge — everything runs in your browser, images never leave your device, and it packs all sizes in one go:

  1. Upload the PNG: click or drop your logo — ideally a square transparent PNG at 256×256 or larger.
  2. Pick sizes: in the "Sizes" group check what you need (16/32/48 for a favicon; everything up to 256 for app icons).
  3. Export: check ICO under Format, hit "Generate icon pack", and download the ZIP containing the multi-size .ico.
  4. Deploy: place the .ico in your site root, or declare it via <link rel="icon"> (snippets in the Favicon guide).

Option 2: Desktop Apps

GIMP (free) exports via File → Export As → logo.ico with multi-size compression options; XnView / IrfanView can export ICO too. Great for offline or batch work — the cost is installing software and hunting for each app's size options.

Option 3: Command Line (ImageMagick)

With ImageMagick installed, one line produces a multi-size ICO from a PNG:

magick logo.png -define icon:auto-resize=256,128,64,48,32,16 logo.ico

icon:auto-resize scales and packs each size automatically. Best for build scripts and automation; for a one-off file, an online tool is faster.

Things to Watch Out For

  • 256px is the ceiling: the ICO spec allows up to 256×256 per image. Larger sources (say 1024px) get scaled to 256 first — fine quality-wise, but don't expect 512px inside an ICO; that's PWA/macOS territory;
  • Start square: non-square images get padded or stretched — center-crop to 1:1 before converting;
  • Transparency survives: ICO supports alpha; a transparent PNG stays transparent (no white box);
  • Don't skip small sizes: an ICO containing only 256px looks mushy in a 16px tab (browsers downscale badly). Always include 16/32;
  • 16px is a dark art: complex logos inevitably blur at that size; professionals draw a simplified mark for it. Icon Forge supports separate Light/Dark variants for exactly these cases.

PNG vs ICO

AspectPNGICO
ContentsOne imageA container holding multiple sizes
Size ceilingNo practical limit256×256 per image
TransparencyYes (alpha)Yes (alpha)
Auto size pickingNoSystem picks 16/32/48/256 per context
Best forSource assets, web imagesWindows favicons, desktop/app icons

In one line: PNG is the asset, ICO is the deliverable. Keep designs in PNG; ship ICO to Windows and favicons.

FAQ

Q: What's the difference between ICO and PNG?

A: PNG is a plain image format — one file, one image. ICO is Windows' icon container: one file can hold multiple sizes (16/32/48/256px), and the system picks the right one per context. You need ICO for favicons and Windows app icons.

Q: Can I just rename .png to .ico?

A: No. ICO is a container format with its own header and multi-image structure; renaming the extension doesn't change the file structure, and most consumers will misread or reject it. Use a real converter.

Q: What's the maximum size inside an ICO?

A: 256×256 per image, per the spec. Converters should pack sizes up to 256 and downscale anything larger first. Bigger targets (macOS icns, PWA 512px) belong to other formats.

Q: Which sizes should favicon.ico contain?

A: Traditionally 16, 32, and 48: 16px for browser tabs, 32px for taskbar/small desktop, 48px for desktop views. Modern browsers also accept PNG/SVG declarations, but a 16/32/48 ICO remains the most compatible baseline.

Q: Does PNG → ICO lose transparency?

A: No. ICO fully supports the alpha channel. As long as the source PNG is transparent and the converter preserves it, the result stays transparent. This site's conversion runs locally and writes alpha through untouched.

Q: How do I check which sizes an ICO contains?

A: Easiest: open the ICO in a browser (it shows the largest image). For the full list use Resource Hacker on Windows, or reload it in this site's icon tool. After generating, always spot-check the 16px variant for clarity.

Convert PNG to Multi-Size ICO — Free

Light/Dark variants · Transparency preserved · All sizes in one pack · Runs in your browser

Open Icon Forge →