I have been reading several articles about uploading documents trough Rest api to Salesforce but could not find the overal difference between binary format or base64.

The main questions I have.

  1. Is/are there specific reasons to chose 1 above the other for a project.
  2. Am I dependent on what format is delivered in the call.

Thanks in advance.


If you can upload in binary format, do so. If your source platform cannot use binary, then use base64. Base64-encoded data is approximately 33% larger, meaning longer upload times, more bandwidth used, and a lower maximum file size for non-multipart uploads.

You can insert or update blob data using a non-multipart message, but you are limited to 50 MB of text data or 37.5 MB of base64–encoded data.

Consider the following:

Plain Text
Hello World

Base64-encoded Text

As you can see, the data is already longer, and this is a very short message. The longer the message, the more "waste" that will be involved.

There is literally no advantage to using base64-encoded data; this option is provided only for greater compatibility with systems that do not support binary file uploads.

  • Another consideration is how the uploaded file is subsequently used - if it is only ever sent to systems that require base64 encoded data that saves time with server-side conversion (at the cost of slower initial upload). I do agree, however, that generally speaking it is better to keep the data "raw" and treat it that way in all places, transforming on demand when required.
    – Phil W
    Jan 12 '21 at 12:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.