Field formatter to display base 64 data image
Try this:

use Drupal\Component\Render\FormattableMarkup;

$src = $item-&gt;value;
$image = new FormattableMarkup('&lt;img src=":src"/&gt;', [':src' =&gt; $src]);
$elements[$delta] = [
  '#markup' =&gt; $image,
];