<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js"],
jax: ["input/TeX", "output/HTML-CSS"],
tex2jax: {
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
processEscapes: true
},
"HTML-CSS": { availableFonts: ["TeX"] }
});
</script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js">
</script>
<link href='https://fonts.googleapis.com/css?family=Belgrano' rel='stylesheet' type='text/css'>
<style type="text/css">
html {
color:#000;
background:#FFF;
}
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td {
text-align: justify;
}
table {
border-spacing:0;
font-size:inherit;
font:100%;
max-width:100%;
background-color:transparent;
border:1px solid #DDD;
border-left:0;
border-collapse:collapsed;
border-radius:4px;
border-radius:4px;
border-radius:4px;
}
fieldset,img {
border:0;
}
address,caption,cite,code,dfn,em,strong,th,var {
font-style:normal;
font-weight:400;
}
ol,ul {
list-style:none;
}
caption,th {
text-align:left;
}
h1,h2,h3,h4,h5,h6 {
font-size:100%;
font-weight:400;
color:#20639b;
margin:1em 0;
}
q:before,q:after {
content:'';
}
abbr,acronym {
border:0;
font-variant:normal;
border-bottom:1px dotted #000;
cursor:help;
}
sup {
vertical-align:text-top;
}
sub {
vertical-align:text-bottom;
}
input,textarea,select {
font-family:inherit;
font-weight:inherit;
font-size:100%;
}
legend {
color:#000;
}
h1,h2,h3,h4,h5,h6,strong {
font-weight:700;
}
em {
font-style:italic;
}
blockquote,ul,ol,dl {
margin:1em;
}
ol,ul,dl {
margin-left:2em;
}
ol {
list-style:decimal outside;
}
ul {
list-style:disc outside;
}
dl dd {
margin-left:1em;
}
th,td {
line-height:1.125em;
text-align:left;
vertical-align:top;
border-top:1px solid #DDD;
border-left:1px solid #DDD;
padding:.5em;
}
th {
font-weight:700;
text-align:center;
color:#20639b;
}
table thead:first-child tr:first-child th,table tbody:first-child tr:first-child th,table tbody:first-child tr:first-child td {
border-top:0;
}
table thead:first-child tr:first-child th:first-child,table tbody:first-child tr:first-child td:first-child {
border-radius:4px 0 0 0;
border-radius:4px 0 0;
border-radius:4px 0 0 0;
}
table thead:first-child tr:first-child th:last-child,table tbody:first-child tr:first-child td:last-child {
border-radius:0 4px 0 0;
border-radius:0 4px 0 0;
border-radius:0 4px 0 0;
}
table thead:last-child tr:last-child th:first-child,table tbody:last-child tr:last-child td:first-child {
border-radius:0 0 0 4px;
border-radius:0 0 0 4px;
border-radius:0 0 0 4px;
}
table thead:last-child tr:last-child th:last-child,table tbody:last-child tr:last-child td:last-child {
border-radius:0 0 4px 0;
border-radius:0 0 4px;
border-radius:0 0 4px 0;
}
table tbody tr:nth-child(odd) td,table tbody tr:nth-child(odd) th {
background-color:#f9f9f9;
}
caption {
margin-bottom:.5em;
text-align:center;
}
p,fieldset,table,pre {
margin-top:.5em;
margin-bottom:.5em;
}
body {
font:20px/1.4 "Belgrano", Helvetica, "Open Sans", Arial, sans-serif;
color:#333;
max-width:960px;
margin:0 auto;
}
pre,code,kbd,samp,tt {
font-family:monospace;
font-size:108%;
line-height:100%;
}
h1 {
font-size:200%;
border-bottom:2px dotted #ddd;
}
a,a:visited,code {
color:#f06024;
}
h2 {
font-size:160%;
}
h3 {
font-size:120%;
}
h4 {
font-size:110%;
}
h5 {
font-size:95%;
}
h6 {
font-size:90%;
color:#999;
}
dl {
margin:0 0 1.125em;
}
dt {
font-weight:700;
line-height:1.125em;
}
dd {
margin-left:1em;
line-height:1.125em;
}
pre,blockquote {
border:1px solid #ddd;
background-color:#f1f1f1;
border-radius:6px;
border-radius:6px;
border-radius:6px;
padding:10px;
}
blockquote {
margin:1em 2.5em;
}
code {
color:#20639b;
background:#f1f1f1;
}
img {
max-width:100%;
}
ol[type=1] {
list-style-type:decimal;
}
ol[type=a] {
list-style-type:lower-alpha;
}
ol[type=A] {
list-style-type:upper-alpha;
}
ol[type=I] {
list-style-type:upper-roman;
}
ol[type=i] {
list-style-type:lower-roman;
}
body {
max-width: 800px;
text-align: center;
}
body p {
line-height: 130%;
margin-bottom: 2em;
}
.center-justified {
text-align: justify;
text-justify: newspaper;
margin: 0 auto;
/* width: 30em; */
margin-left: 2em;
margin-right: 2em;
}
</style>
<!-- RobustLinks CSS -->
<link rel="stylesheet" type="text/css" href="http://robustlinks.mementoweb.org/tools/js/robustlinks.css" />
<!-- RobustLinks Javascript -->
<script type="text/javascript" src="http://robustlinks.mementoweb.org/tools/js/robustlinks-min.js"></script>
<script type="text/javascript" src="http://robustlinks.mementoweb.org/tools/js/robustlinks-uri-exclude-list.js"></script>
</head>
<body><div class="center-justified">
<h1 id="psa-the-difference-between-kilobyte-kb-kibibyte-kib-kilobit-and-kibibit-.">PSA: The difference between kilobyte (KB), kibibyte (KiB), kilobit (kb), and kibibit (kib).</h1>
<p>There are 8 bits in a byte. There are 1024 bytes (B) in a kibibyte, and 1000 bytes in a kilobyte, which is based on the <a href="http://physics.nist.gov/cuu/Units/binary.html" data-versionurl="http://timetravel.mementoweb.org/list/20070123052015/http://physics.nist.gov/cuu/Units/binary.html" data-versiondate="2007-01-23 05:20:15">International System of Units (SI)</a>. This is because kibibyte is based on powers of 2, while kilobyte, being based on standard prefixes, is based on powers of ten.</p>
<p>Sure, the difference between 1024B and 1000B is not that bad, but due to the way exponents work, the difference become more apparent the more bytes you are measuring. For example, a Gigabyte (the convention the hard drive manufacturers use) is $(10\text{B})^9=~$one billion bytes, whereas a Gibibyte is $(1024\text{B})^3=~$one billion seventy-three million seven hundred forty-one thousand eight hundred twenty-four bytes. This means that, for each gigabyte, there is a difference of $((1024\text{B})^3-(10\text{B})^9)/10\text{B}^6=73.74182\text{MB}$, or approximately 73.74 megabytes. If you're buying a terabyte hard drive, it will have 10^12 bytes. However, Windows might tell you it has 931.32 GB. That's because <a href="https://veuwer.com/i/34f5.png" data-versionurl="http://web.archive.org/web/20150929181809/https://veuwer.com/i/34f5.png" data-versiondate="2015-09-29">although Windows uses the abbreviation GB, which is usually for gigabytes, it really means gibibytes</a>. This leads to some confusion, such as <a href="http://www.cnet.com/news/gigabytes-vs-gibibytes-class-action-suit-nears-end/" data-versionurl="http://web.archive.org/web/20150604153931/http://www.cnet.com/news/gigabytes-vs-gibibytes-class-action-suit-nears-end/" data-versiondate="2015-06-04">thumb drive manufacturers being sued for allegedly misadvertising their file sizes.</a></p>
<p>By the way, if that didn't confuse you enough, there is also the distinction of bits (b) vs. bytes (B). There are 8 bits in a byte, so when an ISP advertises gigabit internet, you're really getting $(10\text{B})^9/8b=125000000B=125$ megabytes (MB) per second. These differences apply at slower speeds as well, so it takes some caution to know precisely how much speed is being offered.</p>
<p>In conclusion, bits are not bytes, gigabytes are not gigabits nor gibibytes nor gibibits, and although it is strategically desirable to move to using the International System of Units for storage, we might never make the transition because it goes against convention.</p>
</DIV>
</body>
</html>
Output
You can jump to the latest bin by adding /latest
to your URL
Keyboard Shortcuts
Shortcut | Action |
---|---|
ctrl + [num] | Toggle nth panel |
ctrl + 0 | Close focused panel |
ctrl + enter | Re-render output. If console visible: run JS in console |
Ctrl + l | Clear the console |
ctrl + / | Toggle comment on selected lines |
ctrl + ] | Indents selected lines |
ctrl + [ | Unindents selected lines |
tab | Code complete & Emmet expand |
ctrl + shift + L | Beautify code in active panel |
ctrl + s | Save & lock current Bin from further changes |
ctrl + shift + s | Open the share options |
ctrl + y | Archive Bin |
Complete list of JS Bin shortcuts |
JS Bin URLs
URL | Action |
---|---|
/ | Show the full rendered output. This content will update in real time as it's updated from the /edit url. |
/edit | Edit the current bin |
/watch | Follow a Code Casting session |
/embed | Create an embeddable version of the bin |
/latest | Load the very latest bin (/latest goes in place of the revision) |
/[username]/last | View the last edited bin for this user |
/[username]/last/edit | Edit the last edited bin for this user |
/[username]/last/watch | Follow the Code Casting session for the latest bin for this user |
/quiet | Remove analytics and edit button from rendered output |
.js | Load only the JavaScript for a bin |
.css | Load only the CSS for a bin |
Except for username prefixed urls, the url may start with http://jsbin.com/abc and the url fragments can be added to the url to view it differently. |