# Bitstring and binary

**URL:** <https://forum.elixirforum.com/t/bitstring-and-binary/2351>\
**Category:** Questions\
**Created:** [November 12, 2016, 1:57pm UTC](https://forum.elixirforum.com/t/bitstring-and-binary/2351 "2016-11-12T13:57:39Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![NobbZ](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/nobbz/32/27235_2.png) [@NobbZ](https://forum.elixirforum.com/u/NobbZ)\
**Post date:** [November 15, 2016, 10:45am UTC](https://forum.elixirforum.com/t/bitstring-and-binary/2351/6 "2016-11-15T10:45:04Z")

</div>

Since you do not specify a size for that given element it is assumed to be 1 byte. So the variable `a` does hold a bitstring of length 8 or a binary of length 1, and should be even a string (while not printable, it does only contain valid codepoints)

Remember the picture from above, every string is a binary and every binary is a bitstring, but not necessarily the other way round.

A bitstring is a binary if and only if it has a number of bits that is evenly devisiable by 8.  
A binary is a string if and only if it does only contain valid unicode codepoints encoded in UTF-8.

So as you can see binary and string are true subsets of binary and string is a true subset of bitstring and binary.

---

_[View the full topic](https://forum.elixirforum.com/t/bitstring-and-binary/2351)._
