# Firebase: “The email address is badly formatted” (auth/invalid-email)

> Firebase says auth/invalid-email: the email address is badly formatted. Trim spaces, check the field is not empty, and check the value reaching Firebase.

Canonical: https://app369.com/fix/firebase-auth-invalid-email/
Last updated: 2026-11-08

Sign-up, sign-in or a password reset fails with auth/invalid-email, or ERROR_INVALID_EMAIL on Android and iOS. Firebase did not get a well-formed email address. Most of the time the address the person typed is fine, and the value that reaches Firebase is not: it has a trailing space, it is empty, or it is a different variable.

**Short answer**

Trim the email before you call Firebase, and log the exact value you pass. Check the field is wired to the right state and is not empty when the button is pressed. Validate the format in the form, and catch auth/invalid-email with a plain message.

## **Why Firebase rejects the email, and the fix**

1. 01 ### **A space before or after the address**
  > “Thrown if the email address is not valid.” [**Firebase, firebase.auth.Auth (signInWithEmailAndPassword)**](https://firebase.google.com/docs/reference/js/v8/firebase.auth.Auth) Phone keyboards and autofill often add a trailing space after the address. Trim the value before every Firebase call. In Flutter the code is invalid-email, without the auth/ prefix.```
const cleanEmail = email.trim();
try {
  await signInWithEmailAndPassword(auth, cleanEmail, password);
} catch (e) {
  if (e.code === 'auth/invalid-email') {
    showMessage('Check the email address.');
  }
}
```
2. 02 ### **The value is empty or comes from the wrong variable**
  > “The email address is badly formatted.” [**GitHub, firebase-js-sdk auth error messages**](https://github.com/firebase/firebase-js-sdk/blob/main/packages/auth/src/core/errors.ts) If the input is not bound to state, or the handler reads an old copy of it, Firebase gets an empty or stale value, which can come back as invalid-email (or missing-email on some methods). Log the value right before the call. Also check the argument order: with the modular SDK, auth comes first, then email, then password.
3. 03 ### **The format really is wrong** A missing @, a comma instead of a dot, or a pasted display name like “Ana <ana@example.com>”. Use an email input type and a light format check in the form, then let Firebase decide the rest.
4. 04 ### **Creating or updating users with the Admin SDK**
  > “The provided value for the email user property is invalid. It must be a string email address.” [**Firebase, Admin Authentication API errors (auth/invalid-email)**](https://firebase.google.com/docs/auth/admin/errors) On the server, createUser and updateUser reject a bad email with the same code. Imported data often has spaces or empty strings, so clean it first.

Checked against the vendor’s docs on November 8, 2026: [Firebase reference: firebase.auth.Auth error codes](https://firebase.google.com/docs/reference/js/v8/firebase.auth.Auth); [Firebase docs: Admin Authentication API errors](https://firebase.google.com/docs/auth/admin/errors); [firebase-js-sdk: auth error messages](https://github.com/firebase/firebase-js-sdk/blob/main/packages/auth/src/core/errors.ts).

## **Rather hand it over?**

Fixed scope, fixed price, paid upfront. The work happens in writing; no call needed.

- [from $450**App Fix Ticket**One reproducible bug in an existing mobile or web app, diagnosed and fixed.**See scope and start**](https://app369.com/fixed-price/flutter-firebase-bug-fix/)
- [from $450**AI-Built App Rescue**A Lovable, Bolt or Cursor app checked end to end in 3 days, then its worst problems fixed at a fixed price.****No issues worth fixing, no charge.**** If the Launch Check finds nothing rated medium or higher, Simon refunds the full $450. You keep the report either way. This applies to the first 10 Launch Checks bought after October 30, 2026.**See scope and start**](https://app369.com/fixed-price/ai-app-rescue/)

Related: [**Firebase auth/weak-password**](https://app369.com/fix/firebase-auth-weak-password/) · [**Firebase auth/invalid-credential**](https://app369.com/fix/firebase-auth-invalid-credential/) · [**Supabase “Email address is invalid”**](https://app369.com/fix/supabase-email-address-invalid/) · [**Firebase auth/email-already-in-use**](https://app369.com/fix/firebase-auth-email-already-in-use/)

Questions

## **More on this error**

<details>

<summary>**Does invalid-email mean the account does not exist? **+</summary>

No. It is about the format of the address you sent. A well-formed address with no account behind it gives a different error.

</details>

<details>

<summary>**Why does it fail only on the phone? **+</summary>

Usually a trailing space from the keyboard or autofill. Trim the value before the call.

</details>

<details>

<summary>**Can you fix it for me? **+</summary>

If one bug is the whole problem, the App Fix Ticket covers it: a written diagnosis first, then the fix. If the app has more going on, the Launch Check is a written check of the whole app. Each issue found is rated critical, high, medium or low, with where it is and how it was confirmed. No issues worth fixing, no charge. If the Launch Check finds nothing rated medium or higher, Simon refunds the full $450. You keep the report either way. This applies to the first 10 Launch Checks bought after October 30, 2026.

</details>

A different error?

## **Describe it and get a written quote**

Send the error and what you were doing. You get a written scope, a fixed price and a timeline; Simon replies by email, usually within one business day.

[**Describe your problem **→](https://app369.com/contact/) [**All fixes**](https://app369.com/fix/)