<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h3 class="title">
      <a name="charset-unicode-utf8mb4">
      </a>
      12.9.1 The utf8mb4 Character Set (4-Byte UTF-8 Unicode Encoding)
     </h3>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045216686416">
  </a>
  <p>
   The
   <code class="literal">
    utf8mb4
   </code>
   character set has these
        characteristics:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      Supports BMP and supplementary characters.
     </p>
    </li>
    <li class="listitem">
     <p>
      Requires a maximum of four bytes per multibyte character.
     </p>
    </li>
   </ul>
  </div>
  <p>
   <code class="literal">
    utf8mb4
   </code>
   contrasts with the
   <code class="literal">
    utf8mb3
   </code>
   character set, which supports only
        BMP characters and uses a maximum of three bytes per character:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      For a BMP character,
      <code class="literal">
       utf8mb4
      </code>
      and
      <code class="literal">
       utf8mb3
      </code>
      have identical storage
            characteristics: same code values, same encoding, same
            length.
     </p>
    </li>
    <li class="listitem">
     <p>
      For a supplementary character,
      <code class="literal">
       utf8mb4
      </code>
      requires four bytes to store it, whereas
      <code class="literal">
       utf8mb3
      </code>
      cannot store the character at
            all. When converting
      <code class="literal">
       utf8mb3
      </code>
      columns to
      <code class="literal">
       utf8mb4
      </code>
      , you need not worry about
            converting supplementary characters because there are none.
     </p>
    </li>
   </ul>
  </div>
  <p>
   <code class="literal">
    utf8mb4
   </code>
   is a superset of
   <code class="literal">
    utf8mb3
   </code>
   , so for an operation such as the
        following concatenation, the result has character set
   <code class="literal">
    utf8mb4
   </code>
   and the collation of
   <code class="literal">
    utf8mb4_col
   </code>
   :
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa14693168"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token function">CONCAT</span><span class="token punctuation">(</span>utf8mb3_col<span class="token punctuation">,</span> utf8mb4_col<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
  </div>
  <p>
   Similarly, the following comparison in the
   <code class="literal">
    WHERE
   </code>
   clause works according to the collation
        of
   <code class="literal">
    utf8mb4_col
   </code>
   :
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa63790147"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> utf8mb3_tbl<span class="token punctuation">,</span> utf8mb4_tbl
<span class="token keyword">WHERE</span> utf8mb3_tbl<span class="token punctuation">.</span>utf8mb3_col <span class="token operator">=</span> utf8mb4_tbl<span class="token punctuation">.</span>utf8mb4_col<span class="token punctuation">;</span></code></pre>
  </div>
  <p>
   For information about data type storage as it relates to
        multibyte character sets, see
   <a class="xref" href="storage-requirements.html#data-types-storage-reqs-strings" title="String Type Storage Requirements">
    String Type Storage Requirements
   </a>
   .
  </p>
 </div>
 <br/>
</div>
