TOOL / 06
字节 转换
在 bit、Byte、KB、MB、GB、TB 等常见存储单位之间实时换算;所有计算仅在浏览器中完成。
不上传输入内容;超大或极小数值会以科学计数法显示。
bit 与 Byte
1 Byte 等于 8 bit。网络带宽常用 bit,文件大小通常使用 Byte。
1024 或 1000?
内存和部分系统常按 1024 换算;硬盘厂商与国际单位制通常按 1000 换算。
实时且私密
输入任一单位后,其余单位会立即更新,整个过程只在当前浏览器中进行。
一、为什么"1 TB 硬盘只有 931 GB"
这是所有存储单位换算问题的源头,值得讲清楚。
硬盘厂商按十进制标容量:1 TB = 1000 GB = 10004 字节。而 Windows 等系统在显示时按二进制计算,并且沿用了 GB 这个单位名:1 TiB = 1024 GiB = 10244 字节。两者相差约 9.95%。
所以一块标称 1 TB 的硬盘,在系统里显示为 10004 ÷ 10244 ≈ 0.909 TiB,约等于 931 GiB。硬盘没有缩水,是两套进制在用同一个词。
国际电工委员会为此定了两组明确的写法:KB/MB/GB 属于 SI 十进制(1000 进制),KiB/MiB/GiB 属于 IEC 二进制(1024 进制)。本工具的「二进制 / 十进制」开关,就是在这两套体系之间切换。
二、bit 和 Byte 差了一个 8 倍
网络带宽用 bit/s(小写 b,常写成 Mbps、Gbps),文件大小用 Byte(大写 B)。1 Byte = 8 bit,所以:
500 Mbps ÷ 8 = 62.5 MB/s
这就是"办了 500 兆宽带,下载却只有 60 多兆"的全部原因——单位不同,不是被运营商坑了(实际速率还会再低一些,因为有协议开销)。
三、怎么用
- 先在顶部选进制:看硬盘、给用户展示容量用「十进制 · 1000」,看内存、算进程占用用「二进制 · 1024」;
- 在任意一个输入框里填数字,其余七个单位会同步换算;
- 数字特别大或特别小时会以科学计数法显示,避免一长串零看错位。
四、常见场景对照
- 服务器内存:标 16 GB,系统里显示 16 GiB,实际约 17.18 × 109 字节;
- 云盘容量:多数按十进制卖,扣掉文件系统元数据后可用空间略小于标称;
- 日志文件:
ls -lh用的是 1024 进制,ls --si用的是 1000 进制,同一文件会显示两个数。
Why a 1 TB drive shows 931 GB
This is the root of every unit confusion, so it is worth stating precisely.
Drive vendors label capacity in decimal: 1 TB = 1000 GB = 10004 bytes. Windows and similar systems display in binary while still writing GB: 1 TiB = 1024 GiB = 10244 bytes. The gap is about 9.95%.
So a drive sold as 1 TB shows 10004 / 10244 = about 0.909 TiB, roughly 931 GiB. Nothing shrank; two number systems are sharing one word.
The IEC defined unambiguous spellings for this: KB, MB, GB are SI decimal (powers of 1000), while KiB, MiB, GiB are IEC binary (powers of 1024). The binary/decimal switch above flips between the two.
bit vs Byte is a factor of 8
Network throughput is quoted in bit/s (lowercase b: Mbps, Gbps); file sizes use Byte (uppercase B). One Byte is 8 bit, therefore:
500 Mbps / 8 = 62.5 MB/s
That is the whole explanation for paying for 500 Mbps and downloading at 60-something. Different units, no swindle — real throughput lands a little lower still because of protocol overhead.
How to use it
- Pick the base first: decimal 1000 for drive capacities and anything shown to users, binary 1024 for memory and process footprints;
- Type a number in any field and the other seven update together;
- Very large or very small values switch to scientific notation so you do not miscount zeros.
Common cases
- Server memory — sold as 16 GB, shown as 16 GiB, about 17.18 billion bytes;
- Cloud storage — usually sold in decimal, with usable space slightly below the nominal figure after filesystem metadata;
- Log files —
ls -lhuses 1024,ls --siuses 1000, so one file can report two numbers.