Byte Calculator/Converter: Convert Memory Units

By Kristen
Updated July 28, 2007

Instructions

Conversion

Enter the value you'd like to convert in the appropriate bit/byte unit field. (Example: enter 1 in the KB field and click submit to see what 1KB looks like in bits or YB). The converter will show you the equivalent value for each unit.

Calculation

Enter in the values for each byte unit. (If the value is zero, you can leave the field blank.) The calculator will add up all of the bytes and display the results converted into each unit.

Calculation: Adding Byte Units of Memory

To add values, enter the values as positive number. (Example: to add 3 B and 1 TB (3B + 1TB) together, just enter 3 in the B field and 1 in the TB field.) The results will show the answer in various units of measurement.

Calculation: Subtracting Byte Units of Memory

To subtract values, enter the value as a negative number. (Example: to subtract 1 MB from 1 GB (1GB - 1MB), enter -1 in the MB field and 1 in the GB, and click submit.) All results will show the answer in various units of measurement.

Enter Your Values!

bits
bytes (B)
kilobytes (KB)
megabytes (MB)
gigabytes (GB)
terabytes (TB)
petabytes (PB)
exabytes (EB)
zettabytes (ZB)
yottabytes (YB)

The Answer...

<% dim b, by, kb, mb, gb, tb, pb, eb, zb, yb, bybi, byby, byk, bym, byg, byt, byp, bye, byz, byy If Request.Form("bit")<>"" Then b=Request.Form("bit") bybi=b/8 End If If Request.Form("byte")<>"" Then byby=Request.Form("byte") End If If Request.Form("kilobyte")<>"" Then kb=Request.Form("kilobyte") byk=kb*(2^10) End If If Request.Form("megabyte")<>"" Then mb=Request.Form("megabyte") bym=mb*(2^20) End If If Request.Form("gigabyte")<>"" Then gb=Request.Form("gigabyte") byg=gb*(2^30) End If If Request.Form("terabyte")<>"" Then tb=Request.Form("terabyte") byt=tb*(2^40) End If If Request.Form("petabyte")<>"" Then pb=Request.Form("petabyte") byp=pb*(2^50) End If If Request.Form("exabyte")<>"" Then eb=Request.Form("exabyte") bye=eb*(2^60) End If If Request.Form("zettabyte")<>"" Then zb=Request.Form("zettabyte") byz=zb*(2^70) End If If Request.Form("yottabyte")<>"" Then yb=Request.Form("yottabyte") byy=yb*(2^80) End If by=bybi+byby+byk+bym+byg+byt+byp+bye+byz+byy %>

<% response.write(b) %> bits + <% response.write(byby) %>bytes + <% response.write(kb) %> KB + <% response.write(mb) %> MB + <% response.write(gb) %> GB + <% response.write(tb) %> TB + <% response.write(pb) %> PB + <% response.write(eb) %>EB + <% response.write(zb) %>ZB + <% response.write(yb) %>YB =

<% response.write(by*8) %> bits

<% response.write(by) %> bytes

<% response.write(by/(2^10)) %> kilobytes

<% response.write(by/(2^20)) %> megabytes

<% response.write(by/(2^30)) %> gigabytes

<% response.write(by/(2^40)) %> terabytes

<% response.write(by/(2^50)) %> petabytes

<% response.write(by/(2^60)) %> exabytes

<% response.write(by/(2^70)) %> zettabytes

<% response.write(by/(2^80)) %> yottabytes